code for program :) - Programmers Heaven

#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

# code for program :)

Posts: 3Member
this is the program that i need to write, i am copying it word for word:

Riley Residence Hall charges different rates for semester room and board
based on the number of meals per day the student wants. the semester rate with no meals is \$300. with one meal per day, the rate is \$450. with two meals per day, the rate is \$520, and with three meals per day, the rate is \$590. store these rates in an array. write a program that allows a student to enter the number of meals desired per day. output the semester room and board rate. name the file SemesterMeals.cpp

• Posts: 3,711Member
What part of it do you need help with? What is it you don't understand. Please ask specific questions.
• Posts: 254Member ✭✭
: this is the program that i need to write, i am copying it word for
: word:
:
:
:
The program is too trivial to offer much help on. You need only one function, which is main.

Output a question using printf() or cout to prompt the user the enter the number of meals.
Input the answer using scanf("%d", &N) or cin >> N;
Check it is in the range 0-3, and if not output an error mesage and terminate.
Do a switch and print out the room rate and board rate for your four possibilities, again using printf() or cout.

The logic is simple

switch(N)
{
case 0:
/* print out message for 0 meals here */
break;
case 1:
/* print out message for 1 meal here */
break
etc
}

• Posts: 3Member
: What part of it do you need help with? What is it you don't

ok i have gone through 3 professors for this class i havent learned anything i dont know what i am doing, all i need to do is pass this class so i can switch my major, i've read the book inside and out and still cant grasp what to do if someone would be kind enough to code these extra credit assignments for me then ill pass the class and then i will never take another programming class again....
• Posts: 3,711Member
Code begging without any effort made by the original poster is against the forum policies, so normally your post would have been deleted. However, Malcom was kind enough to reply still.
• Posts: 1Member
: : this is the program that i need to write, i am copying it word for
: : word:
: :
: :
: :
: The program is too trivial to offer much help on. You need only one
: function, which is main.
:
: Output a question using printf() or cout to prompt the user the
: enter the number of meals.
: Input the answer using scanf("%d", &N) or cin >> N;
: Check it is in the range 0-3, and if not output an error mesage and
: terminate.
: Do a switch and print out the room rate and board rate for your four
: possibilities, again using printf() or cout.
:
: The logic is simple
:
: switch(N)
: {
: case 0:
: /* print out message for 0 meals here */
: break;
: case 1:
: /* print out message for 1 meal here */
: break
: etc
: }
:
: How long did you learn it to write such things?
: __________________________________

• Posts: 3,711Member
: : How long did you learn it to write such things?

I'd say one or two weeks.
• Posts: 3Member
: : : How long did you learn it to write such things?
:
:
: I'd say one or two weeks.

excuse me...ive actually been in this class for almost 15 weeks...and have gone through 3 instructors..and i am just now being introduced to this kind of stuff...sorry that i dont get things right away!!!!!!!!!!!!!!!!!!!!
• Posts: 3,711Member
I refer to 1-2 weeks of full-time study.

Anyway, that class doesn't sound too good... I'd get a good C/C++ book and study it instead. There are decent online tutorials too.