Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program for a clerk of Fresh Fruit Store so that the clerk will input the items that a customer buys and then print

  1. Write a program for a clerk of Fresh Fruit Store so that the clerk will input the items that a customer buys and then print out the name, unit price, quantity, and cost of all item and the total cost as a receipt.

The program should do the following:

  1. Define a new data type, fruit, as a C++ class. The class fruit should include:
  • The name of the fruit in an item. Ex: Apple, Banana, ..
  • The unit price of the fruit in the item. Ex: 0.99 ($/lb), 1.29 ($/lb), .
  • The quantity of the fruit that the customer buys. Ex. 2 lbs, 3.5 lbs, ..
  • Set the name, unit price, and quantity of the fruit in the item.
  • Set the name of the fruit in the item only.
  • Set the unit price of the fruit in the item only.
  • Set the quantity of the fruit in the item only.
  • Return the name of the fruit in the item.
  • Return the unit price of the fruit in the item.
  • Return the quantity of the fruit in the item.
  • Return the cost of the item. (cost = unit price * quantity)
  • Constructor with three default value

name = , unit price = 0.0, quantity = 0.0.

  • Overloading the operator << to print the item in the following format:

Ex:

Apple $0.99/lb 3 lb $2.97

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro Database Migration To Azure Data Modernization For The Enterprise

Authors: Kevin Kline, Denis McDowell, Dustin Dorsey, Matt Gordon

1st Edition

1484282299, 978-1484282298

More Books

Students also viewed these Databases questions