...

View Full Version : Need help student urgent



JadeEyes
09-23-2012, 12:15 PM
Hello..!!

For the past 2 weeks due to medical problems, i was unable to attend my courses at University. Yesterday,while checking my university mail, I saw that assignment. I've got this computer programming work to be submitted online today at latest midnight, i.e, 7 hours left, to complete this work.

Given I was absent in class, I completely lost for the two last question. When I saw them, I was like "WTF! Did we do that in class!!". I'm still a first year student. So, i'm still a beginner in program design. I'm used to using the <stdio.h> library. I'm usin Dev C++.

If possible please explain the logic behind the codes used.

Please Help..!!

I'd be really grateful.

Here they are:

According to University regulations, the following mapping between a student’s final mark and the indicative classification of degree is provided for guidance of the board of examiners.

>= 70 First Class Honours
60-69 Upper Second Class Honours
50-59 Lower Second Class Honours
40-49 Third Class Honours
<40 Not an honours degree

(There are other regulations that affect the degree classification.)

Write a program to prompt the user to enter a mark as a floating point number. Check that the mark is in the range 0.0 – 100.0 and, if it is, display the indicative degree classification according to the mapping above and if not, then display a message saying that the marks input is invalid.

Test your program to ensure that the mapping is correct.


Next one:

The UK sequence of traffic lights is:
"Red" (means stop); this is followed by:
"Red and Amber" (means prepare to go); this is followed by:
"Green" (means go); this is followed by:
"Amber" (means prepare to stop); this is followed by:
"Red"; etc..
Write a program that prompts the user to enter the current state of a traffic light, then displays the next state.

For example, if the current state is "Red and Amber", the next state is "Green".

Use a menu system to obtain the current.



Thank You..!! :)

JadeEyes
09-23-2012, 04:10 PM
For question 4,

#include<iostream.h>

void main()

{

float num;

cout<<"Enter marks:"<<endl;

cin>>num;

if(num>=0.0 && num<=100.0)

{

if(num>=70.0)

cout<<"First Class Honours";

else if(num>=60.0 && num<70.0)

cout<<"Upper Second Class Honours";

else if(num>=50.0 && num<60.0)

cout<<"Lower Second Class Honours";

else if(num>=40.0 && num<50.0)

cout<<"Third Class Honours";

else if(num<40.0)

cout<<"Not an honours degree";

}

else

{

cout<<"Marks input is invalid";

}

}


Is it good? ..
Could it be improved?

JadeEyes
09-23-2012, 04:14 PM
For the other one i'm still clueless..!! Please help..!! :)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum