store can use to represent an invoice for an item sold at the store. This class should consist of the following variables as private variables:
• itemName as String
• quantity as integer. This represent the number of item sold
• price as float. This represent the price per item
Also, the invoice class should consist of the following functions:
• constructor function: this function initializes the values of private members.
• Setter and getter functions for each of private variable.
• getInvoiceAmount function. This function calculates and return the invoice amount (invoice amount = quantity × price).
• Print function, which print the itemName, quantity, price, and invoice amount on screen. The format of the output should be look like the figure below (see figure (1) below).
In the main function, define three objects of type invoice and set their data as follows:
• Item1 = ("LapTop-Dell", 3, 3200)
• Item2 = ("Printer-HP", 2, 350)
• item3 = ("USB-16GB", 25, 100)
After that, calculate the invoice amount for each of them and print their information (by calling getInvoiceAmount and print functions)
Finally, calculate the total amount (Total Amount = (amount1 + amount2 + amount3), and print it on the screen

بنت الايمانالمواقع والبرامج


أكثر...