Sale!

COMP 133 Assign # 1 solved

Original price was: $35.00.Current price is: $30.00. $25.50

Category:

Description

5/5 - (4 votes)

Write a C program that calculates the price of a pizza and prints the receipt as follows:

 

  • Your program should first ask the user to enter the size of the pizza (integer value 1=large, 2=medium, 3=small) as well as the number of toppings (integer).
  • Your program should then read the pizza basic price (double) as well as the price of a topping ( float ) from a file called txt
  • Your program should then calculate the total price of the pizza using the following formula:

 

Total price = ( basic price + number of toppings * topping price ) / size;

 

And print a receipt which displays the details of your pizza order as well as the final total price to the screen

 

Your program should include at least two functions:

  • Function calculate_Price which takes the basic price, number of toppings, topping price, and size as parameters and returns the total price.
  • Function print_Receipt which takes the number of toppings, size of pizza and total price as parameters and prints them to the screen.

 

 

VERY IMPORTANT:

 

  1. Turn in your assignment by replying to the course coordinator’s message on Ritaj and attaching your code file (main.c).

 

  1. DO NOT SEND a MESSAGE To YOUR INSTRUCTOR WITH YOUR ASSIGNMENT.  DOING so will RESULT in RECEIVING a GRADE of ZERO for the assignment even if YOU TURN it in by the due date and time.

 

  1. You must include your full name, student id number, and lab section number in a comment at the beginning of your main.c code file.

 

Example of a Sample Run

 

Assuming that you already have a file called prices.txt which has the following values:

30.5         3.25

 

Your program should run as follows:

 

Enter size of pizza – 1, 2, or 3:

2

Enter number of toppings on pizza:

4

 

Receipt:

            Size of Pizza = 2

            Number of Toppings= 4

            Total Price = 21.75 sheikel

 

 

 

Extra Notes:

Note that you deal with the size completely as an integer.

Do not turn in your prices.txt file with the assignment. Only your main.c file.