A company LM sales several types of products: LM201 - price $11.99 per unit, LM202 - price $12.99 per unit, LM203 price $14.99 per unit and LM204 price $15.99

The company LM asks for the application to allow employees to receive the order from the customers and print out the receipt on the screen for each sale transaction. Also, the application allow users can print out the sale report at the end of a day, at the end of month and at the end of a year

The unit price of these products should be defined as constants

First, the application displays the message to ask the name (String) of the employee who uses the application. Then read the name and display the menu where "03/04/20" is generated as current date

COMPANY LM – LUIS MARTINEZ
SALE PRODUCTS LM – Mary Lane
Today: 03/04/20
1. Sale Product LM
2. Ending day sale report
3. Ending month sale report
4. Ending year sale report
0. Exit

TASK1: SALE PRODUCT LM

For each sale transaction:

  • Display the product list to allow users to select model then read number of units. After read one model, redisplay the list to allow users to select other model until users select Exit
COMPANY LM – LUIS MARTINEZ
SALE PRODUCTS LM – Mary Lane
Today: 03/04/20
1. Model LM201
2. Model LM202
3. Model LM203
4. Model LM204
0. Exit
  • Display message and read the amount paid from users
  • Apply the formula to calculate the charge then display the receipt on the screen
Sale model LM201 = unit price of LM201 * number of unit model LM201 sold
Sale model LM202 = unit price of LM202 * number of unit model LM202 sold
Sale model LM203 = unit price of LM203 * number of unit model LM203 sold
Sale model LM204 = unit price of LM204 * number of unit model LM204 sold

Subtotal = Sale model LM201 + Sale model LM202 + Sale model LM203
Tax = subtotal * 8.25%
Total = subtotal + Tax
Balance = amount paid – total
  • The output of the receipt should be as below where all the numbers should be aligned in columns
.............................................
RECEIPT - COMPANY LM
.............................................
Date: 03/04/20
Sale transaction: 040001
Sale employee: Mary Lane
.............................................
Model LM201 (11.99/per unit) 10 119.90
Model LM202 (12.99/per unit) 10 129.90
Model LM203 (14.99/per unit) 10 149.90
Model LM204 (15.99/per unit) 10 159.90
.............................................
Subtotal: 559.60
Tax(8.25%) 46.17
Total: 605.77
Amount paid: 620.00
Balance: 14.23
  • Where the transaction is created in the following format: dd####. The first transaction of the day 03/04/2020 is 040001. The second transaction of the day 03/04/2020 is 040002, etc.
  • At the same time the sale transaction displayed on the screen, the program should write the information of this transaction to the output file named daySale_mmddyy.txt (For example, daySale_200304.txt
  • For example, open file daySale_030420.txt and write one line for one sale transaction
040001 10 10 10 10
  • where:
    • The first column is transaction number
    • The second column is number of the product LM201 units sold
    • The third column is number of the product LM202 units sold
    • The fourth column is number of the product LM203 units sold
    • The last column is number of the product LM204 units sold
  • For example: in 03/04/20, there are 10 sale transaction as below
040001 10 10 10 10
040002 12 12 12 25
040003 14 21 18 16
040004 12 18 10 21
040005 10 8 12 18
040006 15 12 14 34
040007 15 15 15 12
040008 20 12 12 10
040009 8 15 10 25
040010 10 8 12 15

TASK 2: PRINT ENDING DAY REPORT

At the end of one day, the users will run the day report

Select the task 2 from the main menu

  • Ask users for the date to run the report. The input should be in the format: mm/dd/yy
  • split the input into mm, dd, yy then create the file name daySale_030420.txt
  • open file daySale_yymmdd.txt (for example daySale_190304.txt to read
  • for each line, split to get number of LM201 units, number of LM202 units, number of LM203 units -> keep adding up total of LM201 units, total of LM202 units, total of LM203 units
  • After the last transaction, close file then calculates and display on the screen the day report:
.............................................
DAY REPORT - COMPANY LM
.............................................
Date: 03/04/20
Number of sale transactions 10
Sale employee: Mary Lane
.............................................
Model LM201 (11.99/per unit) 126 1510.74
Model LM202 (12.99/per unit) 131 1701.69
Model LM203 (14.99/per unit) 125 1873.75
Model LM203 (15.99/per unit) 186 2974.14
.............................................
Subtotal: 8060.32
Tax(8.25%) 664.98
Total: 8725.30
  • Also, open the output file named monthSale_mmyy.txt, for example, monthSale_0320.txt And write one line to the file then close file For example: in the file monthSale_0320.txt
4 126 131 125 186
  • Where:
    • the first column is day (from 1 to 31 for Mar
    • the second column is number of LM201 units sold,
    • the third column is number of LM202 units sold,
    • the fourth column is number of LM203 units sold
    • the last column is the number of LM204 units sold
    • (see whole file in the file monthSale_2003.txt downloaded from eCampus)

TASK 3: PRINT END MONTH REPORT

At the end of month, the users will run the month report

Select the task 3 from the main menu

  • Ask users for the month to run the report. The input should be in the format: mm/yy
  • split the input into mm, yy then create the file name monthSale_0320.txt
  • open file monthSale_yymm.txt (for example monthSale2003.txt to read (download file from eCampus)
  • for each line, split to get number of LM201 units, number of LM202 units, number of LM203 units and number of LM204 units -> while reading one line, keep adding up total of LM201 units, total of LM202 units, total of LM203 units and total of LM204 units
  • After the last line, close file then calculates and display on the screen the month report:
.............................................
MONTH REPORT - COMPANY LM
.............................................
Month: 03/20
Sale person: Mary Lane
.............................................
Model LM201 (11.99/per unit) 3972 47624.28
Model LM202 (12.99/per unit) 4096 53207.04
Model LM203 (14.99/per unit) 3974 59570.26
Model LM203 (15.99/per unit) 3785 60522.15
.............................................
Subtotal: 220923.70
Tax(8.25%) 18226.15
Total 239149.85
  • Also, open the output file named yearSale_yyyy.txt, for example, yearSale_2020.txt And write one line to the file then close file For example: in the file yearSale_2020.txt
3 3972 4096 3974 3785
  • where the first column is month (from 1 to 12, 3 for March), second column is the number of LM201 units sold, the third column is the number of LM202 units sold, the fourth column is the number of LM203 units sold and the last column is the number of LM204 units sold (see whole file in the file yearSale20.txt downloaded from eCampus)

TASK4: PRINT ENDING YEAR REPORT

At the end of year, the users will run the year report

Select the task 4 from the main menu

  • Ask users for the year to run the report. The input should be in the format: yyyy
  • get the last two digits yy then create the file name yearSale_yyyy.txt
  • open file yearSale_yyyy.txt (for example yearSale_2020.txt to read (download file from eCampus)
  • for each line, split to get number of LM201 units, number of LM202 units, number of LM203 units, number of LM204 units -> while reading one line, keep adding up total of LM201 units, total of LM202 units, total of LM203 units and total of LM204 units
  • After the last line, close file then calculates and display on the screen the month report:
.............................................
YEAR REPORT - COMPANY LM
.............................................
Year 2020
Sale person: Mary Lane
.............................................
Model LM201 (11.99/per unit) 39849 477789.51
Model LM202 (12.99/per unit) 42194 548100.06
Model LM203 (14.99/per unit) 40831 612056.69
Model LM204 (15.99/per unit) 37128 593676.72
.............................................
Subtotal: 2231622.98
Tax(8.25%) 184108.90
Total 2415731.88
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.