Question

You have decided to volunteer at your local history museum which sells tickets for admission. The...

You have decided to volunteer at your local history museum which sells tickets for admission. The museum curator has asked you to write a program that can help calculate the cost of one ticket for admission to the museum. Children under 6 are admitted for free, while all other children are charged $2.93 per ticket. Adults (18 and over) are charged $8.65 per ticket. All tickets that are not free have a convenience cost of $0.85, and all sales are subject to 10% sales tax (after the convenience fee is added). Furthermore, the owners want to offer an incentive of 20% off the price of a ticket when it is purchased on a weekday. The discount only applies to the price of the ticket, not to the convenience fee or sales tax. The program should allow the user to also input a day of the week as a word (e.g. Monday, Tuesday, etc.) which factors into the calculation of the cost of one ticket. Finally, display a wellformatted message that includes the age of the customer, cost of the ticket (with convenience fee and discount, if applicable), sales tax amount, and total cost including all fees and tax.

If at any time the user inputs an invalid value, the program should end with a message stating the user has entered an invalid value and the program should instruct the user to manually restart the program if they want to try again.

Questions:

1) Create a defining diagram that shows the input, processing, and output

2) Create a solution algorithm using pseudocode

3) Show testing using the desk checking table method, to include test data, expected results, and a desk checking table. Make sure your desk checking considers multiple cases including both valid and invalid test data to prove your algorithm will work in all cases

Homework Answers

Answer #1

Editable code:

3) Program:

#include <stdio.h>

#include <string.h>

int main()

{

int age;

char day[15];

float tcost,concost=0.85,stax=0,disc=0,totcost=0;

while(1)

{

printf("\n Enter your age: ");

scanf("%d",&age);

if(age<0)

{

printf("ERROR: invalid value!!!");

break;

}

if(age>0 && age<6) tcost=0;

if(age>=6 && age <18) tcost=2.93;

if(age>=18) tcost=8.65;

printf("Enter day of the week: ");

scanf(" %s",day);

if(strcmp(day,"monday")==0 || strcmp(day,"tuesday")==0 || strcmp(day,"wednesday")==0 || strcmp(day,"thursday")==0 || strcmp(day,"friday")==0)

disc=tcost*0.2;

else if(strcmp(day,"saturday")==0 || strcmp(day,"sunday")==0)

disc=0;

else

{

printf("ERROR: invalid value!!!");

break;

}

printf("\n***TICKET***");

printf("\nAge: %d",age);

printf("\nCost of ticket: $%0.2f", tcost+concost-disc);

stax=(tcost+concost)*0.1;

printf("\nSale tax Amount: $%0.2f", stax);

totcost=tcost+concost-disc+stax;

printf("\nTotal cost: $%0.2f\n", totcost);

break;

}

return 0;

}

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
This is a Java program Program Description You work for a local cell phone company and...
This is a Java program Program Description You work for a local cell phone company and have been asked to write a program to calculate the price of a cell phone data plan being purchased by a customer. The program should do the following tasks: Display a menu of the data plans that are available to be purchased. Read in the user’s selection from the menu.  Input Validation: If the user enters an invalid option, the program should display an error...
Please read the article and answear about questions. Determining the Value of the Business After you...
Please read the article and answear about questions. Determining the Value of the Business After you have completed a thorough and exacting investigation, you need to analyze all the infor- mation you have gathered. This is the time to consult with your business, financial, and legal advis- ers to arrive at an estimate of the value of the business. Outside advisers are impartial and are more likely to see the bad things about the business than are you. You should...
What role could the governance of ethics have played if it had been in existence in...
What role could the governance of ethics have played if it had been in existence in the organization? Assess the leadership of Enron from an ethical perspective. THE FALL OF ENRON: A STAKEHOLDER FAILURE Once upon a time, there was a gleaming headquarters office tower in Houston, with a giant tilted "£"' in front, slowly revolving in the Texas sun. The Enron Corporation, which once ranked among the top Fortune 500 companies, collapsed in 2001 under a mountain of debt...
Discuss how the respective organizations’ relations with stakeholders could have potentially been affected by the events...
Discuss how the respective organizations’ relations with stakeholders could have potentially been affected by the events that took place at Enron and how the situation could have been dealt with differently to prevent further damage? THE FALL OF ENRON: A STAKEHOLDER FAILURE Once upon a time, there was a gleaming headquarters office tower in Houston, with a giant tilted "£"' in front, slowly revolving in the Texas sun. The Enron Corporation, which once ranked among the top Fortune 500 companies,...
Delta airlines case study Global strategy. Describe the current global strategy and provide evidence about how...
Delta airlines case study Global strategy. Describe the current global strategy and provide evidence about how the firms resources incompetencies support the given pressures regarding costs and local responsiveness. Describe entry modes have they usually used, and whether they are appropriate for the given strategy. Any key issues in their global strategy? casestudy: Atlanta, June 17, 2014. Sea of Delta employees and their families swarmed between food trucks, amusement park booths, and entertainment venues that were scattered throughout what would...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT