Can anyone help me solve this assignment



Decision-Making and Iterations

Assignment Question

1

Howell University is an accredited European university, which offers a range of courses to its students. It strives to give students the very best in terms of education and course content.

Now the university management is introducing a new IQ testing system for its MBA students, which is an add-on to the traditional Examination System. This tests the IQ of the students by testing them on four different subjects like Aptitude, English, Mathematics and General Knowledge.

Consider yourself to be a part of the software development team that is supposed to design the application in cplusplus. First the application asks the student the number of attempt. If student responds with a value higher than 1, then the application terminates and displays a corresponding message. However, if the student is attempting the test for the first time, it displays the following menu: 1. Aptitude

2. English

3. Math

4. GK

5. Exit



On entering a value between 1 and 4, the application displays the corresponding question. Note that the student can attempt only once for each subject listed.



When a student enters the correct answer for the question, the score for that subject gets incremented by 10 points. Once the student appears the test for all the subjects, he/she can choose to exit the application. After selecting the Exit option, the student can get the total marks printed on the screen.

The total scores should be calculated by adding up all the individual scores in each subject. Next the application displays the following based on the score: Bonus points earned

Total score out of 50

Message on IQ level

The application displays the bonus points based on the following conditions: 1. No bonus point is given, when the total score equals to 10.

2. A bonus of 2 points is given, when the total score equals to 20.

3. A bonus of 5 points is given, when the total score equals to 30.

4. A bonus of 10 points is given, when the total score equals to 40.

The message on IQ level is displayed on the basis of following conditions: 1. If the final score equals 10, then a message is printed saying “Your IQ level is below average".

2. If the final score equals 22, then a message is printed saying “Your IQ level

is average".

3. If the final score equals 35, then a message is printed saying “You are intelligent".

4. If the final score equals 40, then a message is printed saying “You are a genius".



If the final score equals 0, then a message is printed saying “You need to re-appear the test".








Sounds quite basic enough, depending how you want the program to look like.

If you want it as a simple console application with the participant writing the numbers (1-5 at subject choice, 1-4 at answers), then even I can do it for you.

If you want something fancy with the participant being able to click buttons (something similar to a windows error message, where you can click ok/cancel/fix, but instead of the message, you get the question, and you have the answers on the buttons), then I maybe able to do it, but it would take me a week to get into object oriented programming.


But the core of the program, aka the decision making of when to give points, of determining if he answered correctly, determining when to give bonus points, etc. is quite simple and can be done in maybe an hour, the graphics part is the more difficult one.


Oh just notice I've wrote a whole page without doing much, so if you only need the decision making part, I can do that for you, but it takes quite a while to do the graphics, and I don't have that time to spend.
its a console application, i would be grateful if you can help
At least have a go.

Else you're joining the long list of people who post on here expecting others to do their work.

Incidentally, that's a very similar list to the list of people I don't want to help.
i have started out with something for sure,but i don't know how to iterate well,especially the point where the total marks are to be calculated and d addition of bonus
Declare an integer called score. Initialise it to zero.

Every time one of the questions is answered correctly, increment the score by ten.

At the end, check the score, if it equals any of the bonus values then add the bonus on.
pls can u explain more,i am just a beginner
I'm not sure how I can simplify it more than that.

Do it step-by-step.

How about showing me what you've got so far?
Very good, you're getting there.

You should write all 5 cases of subject, and in each case (with the exception of the exit case), write the questions into (question into one line, answer into another line, next question in third line, answer in fourth and so on).

Then open the file, use a string (char s[50]), with getline(s,49), you can take the question into the string, which you can later display with puts(s) function. Then take the answer into an int variable. Then, test the entered value if it's the same as the answer, if yes, give points and display that he's correct, if wrong, don't give points, only display that he's wrong.



PS: HUGE THING TO WATCH OUT FOR: if you do this as I've said, you'll have a file like this:
1
2
3
4
How many weeks do we have in a year
52
How many days are in a week
7


When you take the int variable, the cursor will stand behind the number but BEFORE the newline, so using getline again will just take the enter, and everything messes up.

So this is how it should look like:
1
2
3
4
5
6
7
8
9
10
11
fstream f;
char question[100];
char empty[2];
int answer;
f.open("Questions.txt",ios::in);
while (!f.eof())
{
getline (question,99);
f>>answer;
getline (empty,1);
}
dont understand ur codes cos i am a beginner& i only know how to use c++.this what i have done.but i want the user to only attempt a question once

#include <iostream>
using namespace std;
int main()
{ int a,subject,answer;
cout<<" Please enter no of attempt:";
cin>> a;
if(a==1){
cout<<"\n1:APPTITUDE"<<"\n2:ENGLISH:"<<"\n3:MATHS:"<<"\n4:GENERAL KNOWLEDGE:"<<"\n5:EXIT"<<endl;
}


else {
cout<<" You can only attempt once:"<<endl;
cout<<"IQ test terminated" <<endl;}
for(subject=1;subject<=5;){
cout<<"Choose subject using no 1=Apptitude,2=English,3=Maths,4=G.K===> ";
cin>>subject;

switch (subject){

case 1:
cout<<"APPITUDE==>";
cout<<"How many weeks do we have in a year"<<endl;
cin>> answer;

if (answer==52){
cout<<"Correct"<<endl;}
else{
cout<<"You are wrong"<<endl;}
break;
case 2:
cout<<"ENGLISH===>";
cout<<"How many syllables are there in EDUCATION"<<endl;
cin>> answer;
if (answer==4){
cout<<"You are correct"<<endl;}
else
{cout<<"You are wrong"<<endl;}
break;
case 3:
cout<<"MATHS==>";
cout<<"What is the square root of 625"<<endl;
cin>> answer;
if(answer==25){
cout<<"Correct"<<endl;}
else{
cout<<"Wrong"<<endl;}
break;
case 4:
cout<<"GENERAL KNOWLEDGE==>";
cout<<"How many state do we have"<<endl;
cin>> answer;
if(answer==36){
cout<<"Correct"<<endl;}
else{
cout<<"Wrong"<<endl;}
break;
default:
cout<<"Wrong Input"<<endl;
break;
}
subject++;


}
return 0;
}
Topic archived. No new replies allowed.