Question

A store is having a sale. The manager wants a program that allows the sales clerk...

A store is having a sale. The manager wants a program that allows the sales clerk to enter the original price of an item and the discount rate. The program should calculate and display the sale price.

find the inputs and outputs, write the pseudocode, and desk check the pseudocode.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

A store is having a sale. The manager wants a program that allows the sales clerk to enter the original price of an item and the discount rate. The program should calculate and display the sale price.Find the inputs and outputs, write the pseudocode, and desk check the pseudocode.

Pseudocode :

Create a Structure or Class

1. Initialize variables for ‘Original Price(price1)’, ‘Discount Rate(discount)’, ‘Sale Price(price2)’.

2. Declare functions or modules for Inputting Data, Calculation, Outputting Data.

Define Function for Inputting Data

1. Input Original Price(price1)

2. Input Discount Rate(discount)

Define Function for Calculation

1. Sale Price(price2)=price1-((price1*discount)/100)

Define Function for Outputting Data

1. Output Sale Price(price2)

Define Main Function

1. Input the Number of Items(size)

2. Declare Array of Structure or Object

3. FROM I=0 to I=size

Call Function for Inputting Data via Array of Objects

Call Function for Calculation

Call Function for Outputting Data via Array of Objects

4. Exit Loop

Program :

#include<iostream>

using namespace std;

class store

{

public:

float price1; //Original Price

float price2; //Sale Price

float discount; //Discount Rate

void getdata(); //Input

void cal(); //Calculation

void putdata(); //Output

};

void store :: getdata() //Enter Original Price & Discount Rate

{

cout<<"\nOriginal Price : ";

cin>>price1;

cout<<"\nDiscount Rate(%) : ";

cin>>discount;

}

void store :: cal() //Calculate the Sale Price

{

price2=price1-((price1*discount)/100);

}

void store :: putdata() //Output the Sale Price

{

cout<<"\nSale Price : "<<price2;

}

int main()

{

int size;

cout<<"\nEnter the Number of Items : "; //Number of Items

cin>>size;

store ob[size]; //Taking Array of Objects

cout<<"\n\n"<<"##"<<"Inputs & Outputs"<<"##"<<"\n\n";

for(int i=0;i<size;i++) //Input & Output Section

{

cout<<"\n\nItem "<<i+1<<" : \n";

ob[i].getdata(); //Calling getdata()

ob[i].cal(); //Calling Cal()

ob[i].putdata(); //Calling putdata();

}

cout<<"\n";

return 0;

}

Output 1 :

Enter the Number of Items : 3

##Inputs & Outputs##

Item 1 :

Original Price : 40

Discount Rate(%) : 2

Sale Price : 39.2

Item 2 :

Original Price : 60

Discount Rate(%) : 4

Sale Price : 57.6

Item 3 :

Original Price : 120

Discount Rate(%) : 4.5

Sale Price : 114.6

Output 2 :

Enter the Number of Items : 5

##Inputs & Outputs##

Item 1 :

Original Price : 87

Discount Rate(%) : 6

Sale Price : 81.78

Item 2 :

Original Price : 152

Discount Rate(%) : 7

Sale Price : 141.36

Item 3 :

Original Price : 888

Discount Rate(%) : 25

Sale Price : 666

Item 4 :

Original Price : 763

Discount Rate(%) : 52.6

Sale Price : 361.662

Item 5 :

Original Price : 460

Discount Rate(%) : 75

Sale Price : 115

Add a comment
Know the answer?
Add Answer to:
A store is having a sale. The manager wants a program that allows the sales clerk...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Mountain Coffee wants a program that allows a clerk to enter the number of pounds of...

    Mountain Coffee wants a program that allows a clerk to enter the number of pounds of coffee ordered, the price per pound, and whether the customer should be charged a 3.5% sales tax. The program should calculate and display the total amount the customer owes. Use an int variable for the number of pounds, a double variable for the price per pound, and a char variable for the sales tax information. a. Create an IPO chart for the problem, and...

  • A store sells cups and plates for parties. The owners want a program that allows them...

    A store sells cups and plates for parties. The owners want a program that allows them to enter the price of a cup, the price of a plate, the number of cups purchased, the number of plates purchased, and the sales tax rate. The program should calculate and display the total cost of the purchase. desk check the pseudocode

  • How do you write out this C++ program and zip the files? A local department store...

    How do you write out this C++ program and zip the files? A local department store is having a BoGoHo (Buy One, Get One Half Off) sale. The store manager wants a program that allows the salesclerk to enter the prices of two items. The program should calculate and display the total amount the customer owes. The half-off should always be taken on the item having the lowest price. For example, if the items cost $24.99 and $10, the half-off...

  • 25. In this exercise, you create a program for the sales manager at Computer Haven, a...

    25. In this exercise, you create a program for the sales manager at Computer Haven, a small business that offers motivational seminars to local companies. Figure 7-53 shows the charge for attending a seminar. Notice that the charge per person depends on the number of people the company registers. For example, the cost for four registrants is $400; the cost for two registrants is $300. The program should allow the sales manager to enter the number of registrants for as...

  • I need help building code in python for this: Create a program that: Creates a sales...

    I need help building code in python for this: Create a program that: Creates a sales receipt, displays the receipt entries and totals, and saves the receipt entries to a file Prompt the user to enter the Item Name Item Quantity Item Price Display the item name, the quantity, and item price, and the extended price (Item Quantity multiplied by Item Price) after the entry is made Save the item name, quantity, item price, and extended price to a file...

  • MEGA SALE 2!!! Your local grocery store is having a 15% off everything sale. But Wait!!!! For the next 3 days they...

    MEGA SALE 2!!! Your local grocery store is having a 15% off everything sale. But Wait!!!! For the next 3 days they are offering a coupon to save an additional $22 on any order over $100. If the store applies the sale price then applies the coupon, find each of the following. Assume the order is over $100 and let represent the price of any item. Round all decimals to 4 decimal places. a) Write a function called sale(2) that...

  • Scenario: John Lee wants a program that allows him to enter the following three pieces of information. His savings accou...

    Scenario: John Lee wants a program that allows him to enter the following three pieces of information. His savings account balance at the beginning of the month, the amount of money he deposited during the month, and the amount of money he withdrew during the month. He wants the program to display his balance at the end of the month. Requirements: Complete an IPO chart for this problem, using pseudo code or flowchart in the Processing column. Also complete a...

  • C++ The manager of Keystone Tile wants an application that displays the area of a rectangular...

    C++ The manager of Keystone Tile wants an application that displays the area of a rectangular floor, given its measurements in feet. It should also display the total cost of tiling the floor, given the price per square foot of tile. 1-Create a new project named Intermediate13 Project, and save it in the Cpp8\Chap04 folder. Enter your C++ instructions into a source file named Intermediate13.cpp. Also enter appropriate comments and any additional instructions required by the compiler. Test the program...

  • Write a C++ program that will calculate the total amount of money for book sales at...

    Write a C++ program that will calculate the total amount of money for book sales at an online store. For each sale, your program should ask the number of books sold and then the price for each book and the shipping method (‘S’ for standard shipping and ‘E’ for expedited shipping). The program will produce a bill showing the subtotal, the sales tax, the discount, the shipping charge, and the final total for the sale. The program will continue processing...

  • Write a program (C++) that shows Game sales. The program should use a structure to store...

    Write a program (C++) that shows Game sales. The program should use a structure to store the following data about the Game sale: Game company Type of Game (Action, Adventure, Sports etc.) Year of Sale Sale Price The program should use an array of at least 3 structures (3 variables of the same structure). It should let the user enter data into the array, change the contents of any element and display the data stored in the array. The program...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT