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

LAB 3.5 – Complete Program Step 1: Remove table.cpp from the project and add the

ID: 3830101 • Letter: L

Question

LAB 3.5 – Complete Program

Step 1: Remove table.cpp from the project and add the icecream.cpp program in your Lab3 folder to the project. This file contains just a program shell in which you will write all the programming statements needed to complete the program.   Here is a copy of the current contents of icecream.cpp.

1 // Lab 3 icecream.cpp
2 // WRITE A COMMENT BRIEFLY DESCRIBING THE PROGRAM.
3 // PUT YOUR NAME HERE.
4 // INCLUDE ANY NEEDED FILES HERE.

5 using namespace std;
6
7 int main()
8 {
9    // DEFINE NAMED CONSTANTS HERE TO HOLD THE PRICES OF THE 3
10    // SIZES OF ICE CREAM CONES. GIVE EACH ONE A DESCRIPTIVE
11    // NAME AND AN APPROPRIATE DATA TYPE.
12   
13    // DECLARE ALL NEEDED VARIABLES HERE. GIVE EACH ONE A DESCRIPTIVE
14    // NAME AND AN APPROPRIATE DATA TYPE.
15   
16    // WRITE STATEMENTS HERE TO PROMPT FOR AND INPUT THE INFORMATION
17    // THE PROGRAM NEEDS TO GET FROM THE USER.
18   
19    // WRITE STATEMENTS HERE TO PERFORM ALL NEEDED COMPUTATIONS
20    // AND ASSIGN THE RESULTS TO VARIABLES.
21   
22    // WRITE STATEMENTS HERE TO DISPLAY THE REQUESTED INFORMATION.
23      
24    return 0;

25 }

Step 2: Design and implement the icecream.cpp program so that it correctly meets the program specifications given below. You may find it helpful to use pseudocode to work out the program logic before you begin coding the program in C++.

Specifications:

The DeLIGHTful Ices Company sells delicious but low-cal “light” ice cream cones in 3 sizes and prices:

DeLIGHTful     (1 scoop) 1.49

Double DeLIGHT (2 scoops) 2.49

Triple DeLIGHT (3 scoops) 3.49

Write a program that prompts the user to enter the number of each cone type sold that day, and then computes and displays a daily sales report that includes the following nicely formatted and labeled information.

Number of cones sold of each type

Total sales $ of each type

Total number of cones sold

Total sales $ of all cones sold

Sample Run

Number of single scoop cones sold: 220

Number of double scoop cones sold: 414

Number of triple scoop cones sold: 66

DeLIGHTful cones       220   $ 327.80

Double DeLIGHT cones   414   $1030.86

Triple DeLIGHT cones    66   $ 230.34

Total                  700   $1589.00

Step 3: Once you have your program working, test it with the data given in the sample run above and with one other good test case of your own.

Step 4: Print a copy of the source code and the output of both runs to hand in to your professor.     

Specifications:

The DeLIGHTful Ices Company sells delicious but low-cal “light” ice cream cones in 3 sizes and prices:

DeLIGHTful     (1 scoop) 1.49

Double DeLIGHT (2 scoops) 2.49

Triple DeLIGHT (3 scoops) 3.49

Write a program that prompts the user to enter the number of each cone type sold that day, and then computes and displays a daily sales report that includes the following nicely formatted and labeled information.

Number of cones sold of each type

Total sales $ of each type

Total number of cones sold

Total sales $ of all cones sold

Sample Run

Number of single scoop cones sold: 220

Number of double scoop cones sold: 414

Number of triple scoop cones sold: 66

DeLIGHTful cones       220   $ 327.80

Double DeLIGHT cones   414   $1030.86

Triple DeLIGHT cones    66   $ 230.34

Total                  700   $1589.00

Explanation / Answer

// icecream.cpp
#include <iostream>
#include <fstream>
#include <string>
using namespace std;

int main( )
{
   int price_small;
   int price_medium;
   int price_large;
   int choice;
   cout<<"Enter price of small icecream: ";
   cin>>price_small;

   cout<<"Enter price of medium icecream: ";
   cin>>price_medium;

   cout<<"Enter price of large icecream: ";
   cin>>price_large;
  
   cout<<"Which price do you want?"<<endl;
   cout<<"1. small"<<endl;
   cout<<"2. medium"<<endl;
   cout<<"3. large"<<endl;
   cin>>choice;  
   bool check = true;
   switch (choice)
   {
       case 1:
           cout<<"Price of small is: "<<price_small<<endl;
           break;
       case 2:
           cout<<"Price of small is: "<<price_medium<<endl;
           break;
       case 3:
           cout<<"Price of small is: "<<price_large<<endl;
           break;
       default:
           cout<<"Invalid choice ..."<<endl;
   }
return 0;
}