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

(IN PSEUDOCODE) Create pseudocode for a program for Hansel\'s Housecleaning Serv

ID: 3796358 • Letter: #

Question

(IN PSEUDOCODE)

Create pseudocode for a program for Hansel's Housecleaning Service.

The program prompts the user for a customer's last name only. While the last name is not “zzz” your program will ask for the number of bathrooms and the number of other rooms to be cleaned and display the cleaning charge. You should use a sentinel-controlled while loop in your main loop logic. A customer name of “zzz” signals the end of the data.

The cleaning charge is $40 plus $15 for each bathroom and $10 for each of the other rooms. Use data validation loop to make sure the number of bathrooms is >= 0, and the number of other rooms is also >= 0. The program will display the total cleaning charge and then prompt for the next customer's name.

When the loop is exited (user enters “zzz” for the last name), display a message indicating that the program is complete.

Your program will have the main module and a function that, given the number of bathrooms and the number of other rooms, will return that total cleaning charge for the customer.

Explanation / Answer

#include <stdio.h>

int cleaning_charge(int a,int b);
int main() {
   int btrm,rm,i,j,sum=0;
   char lname[15];
   char end[3]="zzz";
   printf("enter the last name of customer ");
   scanf("%s",lname);
   printf(" enter the number of bathrooms and other rooms");
   scanf("%d%d",&btrm,&rm);
   while(strcmp(lname,end) != 0) //To compare wheather lastname is not equal to zzz
   {
   if(btrm<=0 || rm<=0) //To detemine the invalid entery of bathrooms or other rooms
   {
   printf(" number of bathrooms or rooms can never be negative");
   }
   else
   {
   sum=cleaning_charge(btrm,rm);
   printf(" Total price of cleaning bathrooms and other rooms is %d",sum);
   }
  
   }
   return 0;
}
int cleaning_charge(int a,int b) //Function to calculate cleaning charges
{
int i,j,sum=0,price=0,tprice=0;
for(i=0;i<a;i++)
{
sum=sum+15;
}
for(j=0;j<b;j++)
{
price=price+10;
}
  
tprice=sum+price+40;
return(tprice);
  
}