С Новым годом! Форум программистов, компьютерный форум, киберфорум
С++ для начинающих
Войти
Регистрация
Восстановить пароль
Блоги Сообщество Поиск Заказать работу  
 
Рейтинг 4.57/7: Рейтинг темы: голосов - 7, средняя оценка - 4.57
0 / 0 / 0
Регистрация: 21.04.2016
Сообщений: 2

Написание программы теста

21.04.2016, 08:09. Показов 1347. Ответов 1
Метки нет (Все метки)

Студворк — интернет-сервис помощи студентам
Здравствуйте дорогие программисты.
Если это возможно прошу помочь с решением проблем
1. Student Registration: Students taking the exam are entered into the grading system via an input file. The file contains the students’ names, ID numbers, and answers to a multiple choice exam.
2. Grading: The user enters an “Answer Key” and then the system grades the students’ answers and calculates the students’ total points, average, and letter grade earned (you are not required to perform data validation);
3. Grade Reporting: The system generates a report (in ascending order) of each student’s name, ID number, exam answers, total points, average and letter grade earned;
4. Analysis Reporting: The system produces three reports (in ascending order) that include the names and graded results of the students who made an A, B, or C (full admission into the program), the names and graded results of the students who made a D (conditional admission into the program), and the names and graded results of the students who failed (F – not admitted to the program);
Due Dates and Honor:
This project will be due by 4:30 pm on Thursday, April 21, 2016. This is a Programming Project, and it is very important that you understand and abide by the policy concerning programming projects (See Academic Integrity Policy below). You are required to complete this assignment independently. If you need help, you should consult with the course tutors or your instructor only. Remember, your personal honor and integrity are far more important than your grade on a project.
Academic Integrity (per the syllabus)
1. In this course, dishonesty in any form will result in the student(s) being dismissed from the course and assigned an “F” at the end of the semester. A report of the Academic Misconduct will be sent to the Registrar’s office. If assignments are copied, both students involved will be dismissed from the course and assigned an “F” at the end of the semester. All assignments must be completed on an individual basis.

Detailed Specification:
1. Student Registration:
The system will read the students’ ID number (an integer), full name (name will be the format: last name, first name), and the students’ 10 multiple choice answers from an input file provided.
2. Grading:
The exam consists of 10 multiple-choice questions. The answer key is entered by the user. Valid choices for each of the exam questions are A, B, C, or D.
3. Grade Reporting:
A report will be produced, sorted in ascending order by name, displaying all the students’ information. (See the report in the Sample Input/Output section.)
4. Analysis Reporting:
Three separate reports will be produced, sorted in ascending order by name, and grouped in the following categories:
a) Admitted into the Graduate Program (students who earned an A, B, or C);
b) Conditional Admission (students who earned a D);
c) Admission Denied (students who earned an F).
(See the report in the Sample Input/Output section.)
Solution Design:
Function decomposition: accomplish each specified task with well designed modular functions.
Solution integration: integrate the modules into a prototype (a working model) for an exam software system.
All coding standards should be followed. You are not required to perform data validation or have the program repeatable.
What to submit and how it will be graded:

Sample Input/Output
Enter the answer key.
Answer 1: ? A
Answer 2: ? C
Answer 3: ? D
Answer 4: ? C
Answer 5: ? A
Answer 6: ? C
Answer 7: ? D
Answer 8: ? B
Answer 9: ? C
Answer 10: ? A

Grading Report

Student ID Student Name Answers_____ Total Pts Average Letter Grade
878 Adams, Jerry A C D C A B D B C A 45.0 90.0 A
44 Ball, Lee A B D C A C D B C A 45.0 90.0 A
666 Dunn, Bob A C D C A C D B C A 50.0 100.0 A
88 Hall, Bill A C D A B C D B C A 40.0 80.0 B
55 Hill, Nathan A C B A B D D B C A 30.0 60.0 D
111 Jones, Paul A C D C A C D B C A 50.0 100.0 A
333 Land, Chris C D B C A B D B A A 25.0 50.0 F
998 Miles, Sue A C D B B B D B C A 35.0 70.0 C
66 Rowe, Steve A C D C A A D B C A 45.0 90.0 A
22 Smith, Mary A C D B A C D B C A 45.0 90.0 A


Students Admitted to the Graduate Program:

Student ID Student Name Total Pts Average Letter Grade
878 Adams, Jerry 45.0 90.0 A
44 Ball, Lee 45.0 90.0 A
666 Dunn, Bob 50.0 100.0 A
88 Hall, Bill 40.0 80.0 B
111 Jones, Paul 20.0 100.0 A
998 Miles, Sue 35.0 70.0 C
66 Rowe, Steve 45.0 90.0 A
22 Smith, Mary 45.0 90.0 A

Students with Conditional Admission to the Graduate Program:

Student ID Student Name Total Pts Average Letter Grade
55 Hill, Nathan 30.0 60.0 D

Students Not Allowed Admission:

Student ID Student Name Total Pts Average Letter Grade
333 Land, Chris 25.0 50.0 F

Programming Ending!




contents of student.txt file

666 Dunn, Bob
A C D C A C D B C A
88 Hall, Bill
A C D A B C D B C A
333 Land, Chris
C D B C A B D B A A
998 Miles, Sue
A C D B B B D B C A
55 Hill, Nathan
A C B A B D D B C A
66 Rowe, Steve
A C D C A A D B C A
44 Ball, Lee
A B D C A C D B C A
22 Smith, Mary
A C D B A C D B C A
111 Jones, Paul
A C D C A C D B C A
878 Adams, Jerry
A C D C A B D B C A


а вот это мой код
#include <iostream>
#include <string.h>
#include<stdio.h>
#include <iomanip>
#include <algorithm>

using namespace std;

struct Answers
{
char Answer[5];
};
struct StudentRecord
{
string name;
int ID;
struct Answers Answers;
double score;
double average;
char letter_grade;
};

void getInformation(StudentRecord* stu, int& No_studs)
{
char reply;
int i = 0;


cout << "Would you like to enter student information?:";
cin >> reply;
while ((reply == 'Y') || (reply == 'y') && (i<No_studs))
{


cout << "Enter Student's " << i + 1 << " information: " << endl;
cout << "Enter name:";
cin >> stu[i].name;
cout << "Enter ID: ";
cin >> stu[i].ID;
cout << "Enter this students 5 answers:" << endl;
for (int j = 0; j<5; j++)
{
cout << "Answer " << j + 1 << ": ";
cin >> stu[i].Answers.Answer[j];
}
i++;
cout << "Would you like to enter student information?:";
cin >> reply;

}

}
void enterKey(char key[])
{
cout << "Enter the Answer Key." << endl;
for (int dex = 0; dex<5; dex++)
{
cout << "Answer " << dex + 1 << ": ";
cin >> key[dex];

}

}
void calculateAvgAndLetter(StudentRecord* stu, int No_studs, char key[5])
{
int pts1;
int pts2;
int pts3;
int pts4;
int pts5;
int i = 0;
int j = 0;

for (int i = 0; i <No_studs; i++)
{
if (stu[i].Answers.Answer[0] == key[0])
pts1 = 10;
else
pts1 = 0;

if (stu[i].Answers.Answer[1] == key[1])
pts2 = 10;
else
pts2 = 0;

if (stu[i].Answers.Answer[2] == key[2])
pts3 = 10;
else
pts3 = 0;

if (stu[i].Answers.Answer[3] == key[3])
pts4 = 10;
else
pts4 = 0;

if (stu[i].Answers.Answer[4] == key[4])
pts5 = 10;
else
pts5 = 0;

stu[i].score = pts1 + pts2 + pts3 + pts4 + pts5;
stu[i].average = stu[i].score * 2;


if ((stu[i].average >= 90) && (stu[i].average <= 100))
stu[i].letter_grade = 'A';

else if ((stu[i].average >= 80) && (stu[i].average <= 89))
stu[i].letter_grade = 'B';

else if ((stu[i].average >= 70) && (stu[i].average <= 79))
stu[i].letter_grade = 'C';

else if ((stu[i].average >= 60) && (stu[i].average <= 69))
stu[i].letter_grade = 'D';

else if ((stu[i].average >= 0) && (stu[i].average <= 59))
stu[i].letter_grade = 'F';
}

}
void sortRecordsByName(StudentRecord * stu, int No_studs) //I need HELP fixing this function
{
bool swap = true;
int j = 0;
StudentRecord temp;

while (swap)
{
swap = false;
j++;
for (int i = 0; i < No_studs - j; i++)
{

if (stu[i].name.compare(stu[i + 1].name.c_str()) > 0)
{
temp.name = stu[i].name;
stu[i].name = stu[i + 1].name;
stu[i + 1].name = temp.name;
swap = true;
}


}
}
}
void displayHeading()
{
cout << setw(10) << "Student ID";
cout << setw(15) << "Student Name";
cout << setw(10) << "Answers";
cout << setw(10) << "Total Pts";
cout << setw(10) << "Average";
cout << setw(10) << "Letter Grade";
cout << endl;
}
void displayResults(StudentRecord *stu, int No_studs)
{

int i = 0;

for (int x = 0; x<No_studs; x++)
{
//Displays all students
cout << setw(10) << stu[x].ID;
cout << left << setw(15) << stu[x].name;
for (int y = 0; y<5; y++)
{
cout << setw(2) << stu[x].Answers.Answer[y] << "";
}
cout << setw(10) << stu[x].score;
cout << setw(10) << stu[x].average;
cout << setw(15) << stu[x].letter_grade;
cout << endl;
}
//Displays students admitted into the program
for (int i = 0; i<No_studs; i++)
{
if (stu[i].letter_grade == 'A' || stu[i].letter_grade == 'B')
{
//Creates table heading
cout << "Students Admitted to the Graduate Program" << endl;

displayHeading();

//Displays student info
cout << setw(10) << stu[i].ID;
cout << left << setw(15) << stu[i].name;
for (int y = 0; y<5; y++)
{
cout << setw(2) << stu[i].Answers.Answer[y] << "";
}
cout << setw(10) << stu[i].score;
cout << setw(10) << stu[i].average;
cout << setw(10) << stu[i].letter_grade;
cout << endl;
}
}
cout << endl << endl;
//Displays student with conditional admission
for (int i = 0; i<No_studs; i++)
{
if (stu[i].letter_grade == 'C')
{
//Creates table heading
cout << "Students with Conditional Admission:" << endl;
displayHeading();

//Displays student info
cout << setw(10) << stu[i].ID;
cout << left << setw(15) << stu[i].name;
for (int y = 0; y<5; y++)
{
cout << setw(2) << stu[i].Answers.Answer[y] << "";
}
cout << setw(10) << stu[i].score;
cout << setw(10) << stu[i].average;
cout << setw(10) << stu[i].letter_grade;
cout << endl;
}
}
//Displays students thar are not allowed
cout << endl << endl;
for (int i = 0; i<No_studs; i++)
{
if (stu[i].letter_grade == 'F')
{
//Creates table heading
cout << "Students Not Allowed Admission: " << endl;
displayHeading();

//Displays student info
cout << setw(10) << stu[i].ID;
cout << left << setw(15) << stu[i].name;
for (int y = 0; y<5; y++)
{
cout << setw(2) << stu[i].Answers.Answer[y] << "";
}
cout << setw(10) << stu[i].score;
cout << setw(10) << stu[i].average;
cout << setw(10) << stu[i].letter_grade;
cout << endl;
}
}

}

bool displayReport(StudentRecord * student, int No_studs)
{
int info;
cout << "Would you like to search for an ID?" << endl;
cout << "Would you like to search for a particular student to display information(1 for yes or 0 for no)? ";
cin >> info;
if (info == 1) return true;
else return false;
}
void searchID(StudentRecord * student, int number_of_students)//I also need HELP with this function.
{
bool check = true;
string acceptence;
int ID;
cout << "Enter the ID of the student: ";
cin >> ID;


while (check)
{
for (int i = 0; i < number_of_students; i++)
{
if (ID == student[i].ID)
{
check = false;
}
}
if (check == true)
{
cout << "No student with this ID" << endl;
cin >> ID;
}
}
}
int LinearSearch(StudentRecord student[], int number_of_students, int ID, int first, int last)
{
int i = 0;
int position = -1;

for (int i = 0; i < number_of_students; i++)
{
if (ID == student[i].ID)
{
position = i;
}
}

return position;
}


int main()

{


//Variable Declaration
int No_studs = 0;
char reply;
char search;
char repeat;
bool check = false;
int i = 0;
const int MAX_STUDENTS = 20;
char key[5];
StudentRecord *stu;
int info = 0;

do
{
//Enter the number of students
cout << "How many students: ";
cin >> No_studs;
stu = new StudentRecord[No_studs];

//Enter the Answer Key
enterKey(key);

//User input is done
getInformation(stu, No_studs);

//Calculates each student score
calculateAvgAndLetter(stu, No_studs, key);

//Moving on with the program
cout << "Here are the reports" << endl;

//Calling the display results in a table format function
displayHeading();
displayResults(stu, No_studs);

sortRecordsByName(stu, No_studs);
cout << "Sorted by Name:" << endl;
displayResults(stu, No_studs);
cout << endl << endl;

cout << "Would you like to search for an ID?:";
cin >> search;

if (search == 'y')
{
searchID(stu, No_studs);
check = true;
}
else
check = false;


while (check)
{
cout << "Would you like to search for another student (y for yes and n for no)?: ";
cin >> search;

if (search == 'y')
{
searchID(stu, No_studs);
check = true;
}
else
check = false;


}

cout << "Would you like to process another group of students(y for yes and n for no)?: " << endl;
cin >> repeat;

} while (repeat == 'y');


return 0;
}
Заранее большое спасибо за вашу помощь
0
Programming
Эксперт
39485 / 9562 / 3019
Регистрация: 12.04.2006
Сообщений: 41,671
Блог
21.04.2016, 08:09
Ответы с готовыми решениями:

Написание в Delphi программы для создания и прохождения теста
Здравствуйте! Очень нужна ваша помощь. Задали курсовой проект, который нужно выполнить в течении 8-ми дней. Боюсь, что я не справлюсь за...

Написание в Delphi программы для создания и прохождения теста
Здравствуйте! Очень нужна ваша помощь. Задали курсовой проект, который нужно выполнить в течении 8-ми дней. Боюсь, что я не справлюсь за...

Написание теста Кагана / теста Мюнстерберга с использованием БД
Подскажите, пожалуйста, как написать тест Кагана, Мюнстерберга используя базы данных!!! ^_^

1
0 / 0 / 0
Регистрация: 21.04.2016
Сообщений: 2
21.04.2016, 08:09  [ТС]
• Design, Develop, Implement, and Test: You will only submit the tested integral prototype with full functionality if you completed them successfully. Otherwise, you may submit a solution with partial functionalities. This means you will submit your solution for the highest numbered step that actually works. For example, if you had a working solution to Step 3, but only a partially complete solution to Step 4, you would submit your Step 3 solution. Each of the four required functionalities is worth 25 points for a total of 100 combined points. Submit your .cpp file via the Exams link on the Blackboard menu.
0
Надоела реклама? Зарегистрируйтесь и она исчезнет полностью.
inter-admin
Эксперт
29715 / 6470 / 2152
Регистрация: 06.03.2009
Сообщений: 28,500
Блог
21.04.2016, 08:09
Помогаю со студенческими работами здесь

Создание программы-теста(оценивание знаний) и вывод теста в форму, с подсчетом оценки(балл за правильный ответ)
Здравствуйте, уважаемые форумчане. У меня назрел еще один вопрос: -Есть задание написать приложение, которое осуществляет...

написание теста
Доброго времени суток). я пишу тестирование на пхп+мускл ,проблема моя в том что , что я не могу прописать правельный ответ т.е у меня...

Написание теста в Delphi
столкнулся с проблемой у меня вопросы к тесту хранятся в текстовом файле ,прочитать файл я смог только у меня выводит все вопросы сразу...

Написание кода теста по Delphi

Написание теста на знание флеш
Задача: сделать что-то вроде теста на знание флеш. У пользователя появляется форма с изображением рабочего окна Flash. Задается вопрос ...


Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:
2
Ответ Создать тему
Новые блоги и статьи
Новый CodeBlocs. Версия 25.03
palva 04.01.2026
Оказывается, недавно вышла новая версия CodeBlocks за номером 25. 03. Когда-то давно я возился с только что вышедшей тогда версией 20. 03. С тех пор я давно снёс всё с компьютера и забыл. Теперь. . .
Модель микоризы: классовый агентный подход
anaschu 02.01.2026
Раньше это было два гриба и бактерия. Теперь три гриба, растение. И на уровне агентов добавится между грибами или бактериями взаимодействий. До того я пробовал подход через многомерные массивы,. . .
Советы по крайней бережливости. Внимание, это ОЧЕНЬ длинный пост.
Programma_Boinc 28.12.2025
Советы по крайней бережливости. Внимание, это ОЧЕНЬ длинный пост. Налог на собак: https:/ / **********/ gallery/ V06K53e Финансовый отчет в Excel: https:/ / **********/ gallery/ bKBkQFf Пост отсюда. . .
Кто-нибудь знает, где можно бесплатно получить настольный компьютер или ноутбук? США.
Programma_Boinc 26.12.2025
Нашел на реддите интересную статью под названием Anyone know where to get a free Desktop or Laptop? Ниже её машинный перевод. После долгих разбирательств я наконец-то вернула себе. . .
Thinkpad X220 Tablet — это лучший бюджетный ноутбук для учёбы, точка.
Programma_Boinc 23.12.2025
Рецензия / Мнение/ Перевод Нашел на реддите интересную статью под названием The Thinkpad X220 Tablet is the best budget school laptop period . Ниже её машинный перевод. Thinkpad X220 Tablet —. . .
PhpStorm 2025.3: WSL Terminal всегда стартует в ~
and_y87 14.12.2025
PhpStorm 2025. 3: WSL Terminal всегда стартует в ~ (home), игнорируя директорию проекта Симптом: После обновления до PhpStorm 2025. 3 встроенный терминал WSL открывается в домашней директории. . .
Как объединить две одинаковые БД Access с разными данными
VikBal 11.12.2025
Помогите пожалуйста !! Как объединить 2 одинаковые БД Access с разными данными.
Новый ноутбук
volvo 07.12.2025
Всем привет. По скидке в "черную пятницу" взял себе новый ноутбук Lenovo ThinkBook 16 G7 на Амазоне: Ryzen 5 7533HS 64 Gb DDR5 1Tb NVMe 16" Full HD Display Win11 Pro
Музыка, написанная Искусственным Интеллектом
volvo 04.12.2025
Всем привет. Некоторое время назад меня заинтересовало, что уже умеет ИИ в плане написания музыки для песен, и, собственно, исполнения этих самых песен. Стихов у нас много, уже вышли 4 книги, еще 3. . .
От async/await к виртуальным потокам в Python
IndentationError 23.11.2025
Армин Ронахер поставил под сомнение async/ await. Создатель Flask заявляет: цветные функции - провал, виртуальные потоки - решение. Не threading-динозавры, а новое поколение лёгких потоков. Откат?. . .
КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2026, CyberForum.ru