Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need help writing a program, the program when running is supposed to look like

ID: 3545925 • Letter: I

Question

I need help writing a program, the program when running is supposed to look like the following ...



Enter the number of guests: 2 Enter the room number for guest #1 :A109 Enter the name for guest #1 :JON SMITH Enter the room charge for guest #1 :329 Enter the meal charge for guest #1 :76 Enter the room number for guest #2 :C501 Enter the name guest #2 : BOB HILL Enter the room charge for gues #2 :1100 Enter the meal charge for guest #2 :221 The total number of guests are: 2 The total room charges are: $1429.00 The total meal charges are: $297.00 The grand total is: $1726.00

Explanation / Answer

#include<iostream>

using namespace std;


int main(){

int n, i;

cout << "Enter the number of guests: ";

cin >> n;

int meal[n], room[n], t_r = 0, t_m = 0, total = 0;

string r[n], first[n], last[n];


for(i = 0; i < n; i++){

cout << " Enter the room number for guest #" << i + 1 << " :";

cin >> r[i];

cout << "Enter the name for guest #" << i + 1 << " :";

cin >> first[i] >> last[i];

cout << "Enter the room charge for guest #" << i + 1 << " :";

cin >> room[i];

t_r += room[i];

cout << "Enter the meal charge for guest #" << i + 1 << " :";

cin >> meal[i];

t_m += meal[i];

}

cout << " ";

cout << "ROOM# CUST NAME ROOM CHG MEAL CHG TOTAL CHG ";

cout << "_____ __________ ________ ________ _________ ";

for(i = 0; i < n; i++){

cout << r[i] << " " << first[i] << " " << last[i] << " $" << (float)room[i] << " $" << (float)meal[i] << " $" << (float)(room[i] + meal[i]) << " ";

}

cout << " The total number of guests are: " << n;

cout << " The total room charges are: $" << t_r;

cout << " The total meal charges are: $" << t_m;

cout << " The grand total is: $" << t_r + t_m;

cout << " ";

}