CIS 1111 Programming Assignment Topic 4 – Expressions 20 Points (PLEASE ANSWER T
ID: 3881068 • Letter: C
Question
CIS 1111 Programming Assignment Topic 4 – Expressions
20 Points
(PLEASE ANSWER THIS WITH WHAT IS EXACTLY SUPPOSED TO BE WRITTEN IN THIS CODE BASED OFF THE INFO: CUSTOMER NAME: SARA SINCLAIR) Description: In this program you are going to design a program to calculate the cost to cater a dinner. You will also develop a program flowchart. The user will enter the number of guests and the length of time (in minutes) for dinner.
Requirements:
1.Output must be labeled and easy to read as shown in the sample below.
2.Naming convention should be followed for all variables.
3.Program must be self-documenting with comments and meaning variable names.
More Requirements:
1.Use the cout statement to prompt the customer for the name of the function.
2.Prompt the customer for his/her full name.
3.Use the getline function to input the name of the event and the customer’s name.
4.Prompt the customer to enter the length of time (in minutes) for the dinner. The minutes will be used to determine how many hours and minutes you will pay the server(s).
5.Prompt the customer to enter the number of guests attending the dinner.
6.There will be one server assigned to every 20 guests. Servers make $18.50 per hour and $.50 per minute for every minute over an hour. For example, 123 minutes will be 2 hours and 3 minutes. Use modulus to determine the number minutes. Both cost per minute and per hour will be constants.
7.When calculating the number of servers use the function ceil to round up. The code for ceil is roundedUpNumber = ceil(numberOfServers).
8.Each dinner will cost $26.70. Make cost per dinner a constant.
9.Calculate the total cost for the event and the average cost per person. The caterer requires a 25% deposit on the event. All decimals must line up in the output.
10.Flowchart the program.
Sample output:
Submit:
Upload the following to the drop box:
Your .cpp file (not zipped) from within the project folder
Screen shot of your code and output.
Your flowchart
Grading Guidelines for This Assignment
Range – Low End
(Did not do or did very little effort)
Range – High End
(Used correctly and spent time/effort on programming)
Names of variables are meaningful and the program comments self-document the program
0
2
Met all stated requirements
0
10
Output is correct given the input, and the output is correctly formatted
0
4
Program compiles and executes without any runtime, syntax, or logic errors
0
3
Upload the C++ .cpp source file and screens shots of the code and console and the flowchart are uploaded to drop box.
0
1
Total Points Possible
0
20
Range – Low End
(Did not do or did very little effort)
Range – High End
(Used correctly and spent time/effort on programming)
Names of variables are meaningful and the program comments self-document the program
0
2
Met all stated requirements
0
10
Output is correct given the input, and the output is correctly formatted
0
4
Program compiles and executes without any runtime, syntax, or logic errors
0
3
Upload the C++ .cpp source file and screens shots of the code and console and the flowchart are uploaded to drop box.
0
1
Total Points Possible
0
20
Explanation / Answer
#include <iostream>
#include <string>
using namespace std;
int main() {
// your code goes here
string name = "";
string func = "";
float no,sercost = 18.50,totcostser,dinnercost = 26.70,pay;
int totser,minutes,n;
float hours,hourscost,total;
cout<<"Enter the name of the function ";
getline(cin,func);
cout<<" enter your name ";
getline(cin,name);
cout<<" Enter the length of the dinner in minutes ";
cin>>n;
cout<<" enter the number of guest : ";
cin>>no;
totser = no/20;
if(no == 0)
{
totser = 1;
}
hours = n/60;
minutes = n % 60;
if(hours>1)
{
hours = hours * 60;
hours = hours - 60;
minutes = minutes * 0.50;
hourscost = sercost + hours*0.50 + minutes;
}
else
{
hourscost = sercost;
}
totcostser = totser*hourscost;
total = dinnercost + totcostser;
cout<<" the total cost for dinner function is "<<total<<"$"<<endl;
pay = (total/100) * 25;
cout<< "you have to pay "<<pay<<"$ in advance";
return 0;
}
OUTPUT:
Enter the name of the function
birthday
enter your name
xxxx
Enter the length of the dinner in minutes
123
enter the number of guest :
50
the total cost for dinner function is 125.7$
you have to pay 31.425$ in advance