+1 (845) 317-8489 [email protected]

Learning Goal: I’m working on a programming project and need the explanation and answer to help me learn.

Project Description

Write a program that allows the user to manage the sales amounts of the current year.


Sample Run

Product Sales Management System

show – Display all sales records
view – View an amount of a specified month
max – View the highest sales amount
min – View the lowest sales amount
edit – Edit an amount of a specified month
total – Get the total of all sales
quit – Terminate the program

Command: shw
Invalid command. Try again

Command: show
jul $9762
dec $2457
may $2429
apr $3463
nov $88
oct $6735
mar $1073
jan $14317
feb $4176
sep $2437
aug $15578
jun $4324

Command: view
Three-character month: jun
The sales amount: $4324

Command: max
The highest sales amount: $15578

Command: min
The lowest sales amount: $88

Command: edit
Three-character month: Jun
Amount: 1000
New amount updated

Command: show
jul $9762
dec $2457
may $2429
apr $3463
nov $88
oct $6735
mar $1073
jan $14317
feb $4176
sep $2437
aug $15578
jun $1000

Command: total
Total: $63515

Command: quit
Thank you for using my app.


Specifications

  • The project should contain three files: main.h, main.cpp, and functions.asm
  • main.h contains the following items:
    • C/C++ libraries – Imports necessary library functions
    • constant definitions – Defines constants for arrays:
      • #define MONTH_SIZE 4 //Max number of characters for the month: 3 letters and ”
      • #define LINE_SIZE 20 //Max number of characters for each line of the text file
      • #define COMMAND_SIZE 10 //Max number of characters for each user command
    • struct definition – Defines a structure named salesRecords that contains the month and the sales amount members
    • function prototypes – Defines function prototypes used in man.cpp and functions.asm
  • main.cpp contains the following functions:
    • main() – Starts the project
    • print_title() – Prints the title of this application
    • print_menu() – Prints the command menu
    • read_file() – Reads a text file
    • write_file() – Writes a new sales amount for a specified month back to the file
    • get_amount() – Receives the new sales amount from the user
  • functions.asm contains the following procedures:
    • show – Displays all data of the year
    • max – Returns the highest sales amount
    • min – Returns the lowest sales amount
    • view – Prints a sales amount for a specified month
    • edit – Modifies a sales amount for a specified month
    • total – Returns the sales total for the year
  • functions.asm also contains the following items:
    • MONTH_SIZE = 4 ;Max number of characters for the month: 3 letters and ”
    • MONTHS = 12 ;Max number of months of the year
    • salesRecords STRUCT
    • Functions prototypes defined in main.cpp: get_amount() and write_file()
    • Data labels and messages
  • Use monthly_sales.txt to get months and sales amounts. Note that a tab character is a delimiter for the month and the amount in this text file.
  • The main function should define a structure for one month data, an array of characters for a command, and an array of 12 structures for all sales.
  • All the commands should be entered in the main function and the program calls corresponding assembly language procedures.
  • Use C/C++ code to read the text file and store the sales data in the array of structures. Each line is stored in a structure which has the following members:
    • char month[MONTH_SIZE];
    • int amount;
  • MONTH_SIZE is a constant which is defined as 4.
  • If the sales data of any month is edited, the program should write the entire updated array of structures back to the text file.
  • Use the integer format for sales amounts.
  • Assume the user enters valid inputs, so you are not required to check data type exceptions.

All files must be ran together and not separately. Please write the code in x86 assembly language with Irvine 32.inc and also using Visual Studio 2022 and not VS Code. Also provide the output similar to the example from the Visual Studio Debugger after code is complete.

(Provided a main.h and main.cpp that does allow for the user to change the sales amount for a specified month but not too sure if it implements the other commands but just wanted to provide a reference.)