Answered step by step
Verified Expert Solution
Question
1 Approved Answer
please help his assignment deals with maintaining information regarding the sales and receipts of various items in a company's inventory Assume that BROOKLYN AUTOS maintains
please help
his assignment deals with maintaining information regarding the sales and receipts of various items in a company's inventory Assume that BROOKLYN AUTOS maintains data on up to 10 cars on a daily basis (these autos are numbered 0-9). This information is maintained in an array inv which stores the current information for each auto. For example if inv[3]-20, this means that there are 20 autos of type 3 currently in stock. Initially, all autos have 0 on hand. 1. Write a method printStock. This function accepts the array inv and the number of autos and prints a chart showing the auto number along with the current inventory 2. Write a method Sales. This function calculates the total value of all autos on hand. The function accepts the array inv, the number of autos, and the cost per auto [for purposes of this assignment, we will assume that all autos are sold at the same price] The function returns the total income potential if all the autos were sold (Hint: compute the total number of autos and multiply by the price.). 3. Write a main method as follows: Create the array inv and initialize all elements to 0 Create a file transInfo. This file contains lines of data, each line representing either a purchase or a return for a particular auto. You are to create the file on disk with the data shown below. Define and open the file (for input) in your main method. Call the method printStock (to print the current status - all autos have 0 on hand). Process the data in transInfo as follows: Each data line contains three items of information. transaction type (1-sale 2 return) auto number (an integer 0-9) number of units (sold or receipt) If the transaction is a receipt, then add the number of autos to the corresponding element of the inv array; if the transaction is a sale, then subtract the number of seats from the corresponding auto inventory. For each transaction, print a log (message) describing the action that you took. Note: If an attempt is made to purchase more autos than are currently available, that transaction should be rejected (and noted on the log). Similarly, if an invalid transaction code is entered, that transaction should be rejected (and noted on the log). This step should end when a data line of all"-1" is encountered Call the method printStock Call the function Sales with an appropriate message (to print the total income for all autos). For purposes of this call, assume the price of a single auto is $10000.00Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started