Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project #472

Open
sandy8669 opened this issue May 4, 2024 · 0 comments
Open

Project #472

sandy8669 opened this issue May 4, 2024 · 0 comments

Comments

@sandy8669
Copy link

DATA TYPE CLASS
Class SP2024_Product_yourLastName
1.provide UML before writing the code
2.provide the datatype class that is about Product

The class SP2024_Product_yourLastName only holds . The int array stores the numbers of units of different product types that the customers order and the following methods:
*No-argument constructor and parameterized constructor
*The method to calculate the money charged on each size of each product model
*The method to calculate the subtotal
*The method to calculate the tax (tax rate = 0.0825)
*The method to calculate the total charge

*Method to build up the output string for the receipt or the report in the following format:

This is the receipt of one transaction

This is the report of the day

This is the report of the month:

This is the report of the year:

*The method writeToFile to build one line to write to the output file: dayFile, month file , year file in the following format:
In the day file:
transactionNumber numberUnitOfModelA numberUnitOfModelB numberUnitOfModelC numberUnitOfModelD

In the month file:
month numberUnitOfModelA numberUnitOfModelB numberUnitOfModelC numberUnitOfModelD

In the year file:
month numberUnitOfModelA numberUnitOfModelB numberUnitOfModelC numberUnitOfModelD

NOTE:
-transactionNumber is in the format: 0001, 0002, 0003 …0009, 0010, 0011, 0012..
-day is in the format 01, 02, 03, … 29, 30, 31
-month is in the format 01, 02, 03, … 09, 10, 11, 12

DRIVER CLASS
Class SP2024_Sale_SP23Product_Application
1.Write the pseudo-code before writing the code
2.The project need the following constants:

static final float MODELA_PRICE = 11.39f;
static final float MODELB_PRICE = 12.59f;
static final float MODELC_PRICE = 13.79f;
static final float MODELD_PRICE = 14.99f;
static float[] price = {MODELA_PRICE, MODELB_PRICE, MODELC_PRICE, MODELD_PRICE};
static final float TAX = 0.0825f;

The company asks for the application to allow users can do the following tasks:
SP2024_SaleProductSP23_Application_Martinez.cpp
SP23 COMPANY MENU - LUIS MARTINEZ
Today: 03/05/2023

1.Sale SP23 Product
2.Print Day Sale Report
3.Print Month Sale Report
4.Print Year Sale Report
0.Exit
Enter a number 1 to 4 to select a task or 0 to exit:

The application allows users to enter a number to select a task to work on. After finishing one task, redisplay the menu to allow users to select other tasks to continue working only terminate when users select 0

TASK1: SALE PRODUCT
The users select 1 from the main menu to select the task1 for Sale Product
-Declare an int array UnitsModel size 4, to store the number of units of 4 product models that users order where
UnitsModel[0] stores the number of units of product model A
UnitsModel1] stores the number of units of product model B
UnitsModel [2] stores the number of units of product model C
UnitsModel [3] stores the number of units of product model D

-Display the list of the product models to allow users to select the product models

SP2024_SaleProductApplication_Martinez.cpp
PRODUCT MODELS MENU - LUIS MARTINEZ
Today: 03/05/2024

SALE PRODUCT:
1.Model A - $11.39
2.Model B - $12.59
3.Model C - $13.79
4.Model D - $14.99
0.Exit
Enter 1, 2, 3 to select the product model or 0 to Exit:

-When users select a model, display the message to ask for the number of units the users order and store the number of units in the array UnitsModel.

You should manage the program to add up the numbers of units of the same model if the users select the same model more than one time.

*Create the object of data type class SP2024_Product_yourLastNname to pass array UnitsModel and array price.
*Using the object to access the method of the data type class to print the receipt
*Open the dayFile_MMddyyyy.txt to write.
*Using the object to access the method writeToFile to get a string to write one line to the file dayFile_MMddyyy.txt in the format:
transactionNumber numberUnitOfModelA numberUnitOfModelB numberUnitOfModelC numberUnitOfModelD

TASK2: PRINT DAY REPORT
Asking for the file name
Check if the file exists
If file exists, open file to read
Use the loop to read the input file:
-On each line of the file:
*read one line where each line store 5 information:
transactionNumber numberUnitOfModelA numberUnitOfModelB numberUnitOfModelC numberUnitOfModelD
*split information into 5 items
*skip the first one, store the next 4 items to an int array UnitsModel size 4.
*create the object of data type class with the array UnitsModel and the array price
*Use the object to access the method to get the report and display the day report
*open the monthFile_MMyyyy.txt to write
*Use the object to access the method writeToFile to get a string to write to the file monthFile_MMyyyy.txt in the format:
Day numberUnitOfModelA numberUnitOfModelB numberUnitOfModelC numberUnitOfModelD

TASK3: PRINT MONTH REPORT
Do the same what you did in task2 with the file monthFile_MMyyyy.txt to get the information for the array UnitsModel, then create the object with the array UnitsModel and the array price and access the method of data type class to print the month report.
Also, open yearFile_yyyy.txt to write and use the object to access the method writeToFile to get the string to write to the yearFile_yyyy.txt in the following format
month numberUnitOfModelA numberUnitOfModelB numberUnitOfModelC numberUnitOfModelD

TASK4: PRINT YEAR REPORT
Do the same what you did in task3 with the file yearFile_yyyy.tx to get the information for the array UnitsModle, create the object with the array UnitsModel and the array price and access the method of data type class to print the year report

HOW TO TURN IN THE LAB
ATTENTION: Compress each project folder into a file .zip or a file .rar. that includes source files and execute files.
-If you do not have the source file and execute file, your lab gets 0 points
-If you do not provide file .class of the part, you only have half of the max score of the part

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant