Get Instant Help From 5000+ Experts For
question

Writing: Get your essay and assignment written from scratch by PhD expert

Rewriting: Paraphrase or rewrite your friend's essay with similar meaning at reduced cost

Editing:Proofread your work by experts and improve grade at Lowest cost

And Improve Your Grades
myassignmenthelp.com
loader
Phone no. Missing!

Enter phone no. to receive critical updates and urgent messages !

Attach file

Error goes here

Files Missing!

Please upload all relevant files for quick & complete assistance.

Guaranteed Higher Grade!
Free Quote
wave
Program 1(C++) and Program 2(C++)
Answered

Program 1: Processing Car Dealership Sales Commission Data

Program 1(C++)

A special type of situation, called a controlled break, can occur when processing records of data must temporarily pause because a key value has changed.  For example, a control break might occur in a report that contains subtotals for groupings of records. 
 
This program requires such a procedure.   
 
Sales people at a local car dealership are paid by commission.  For every car sale, a sales person earns 30% of the base price or $100, whichever is higher.   
 
Write a program that uses of a loop to read through and process records in a file.  Whenever the program encounters a new employee id, it should pause processing long enough to display the total of the previous employee’s commissions before processing the record just read.  After all records have been processed, the program should display a count of the records processed, the total sales, and the total commissions paid out.

A sample input file, carsales.dat, to generate the report is shown below.  The first value in a line is the employee id.  The second value is the retail sale amount of the car (without tax.)  The third item is the base price on which the sales person’s commission is determined.  Note:  It is important that our data set is sorted by sales person id number.  If the data set is not sorted, the control-break process won't work. 

101  

24125  1201

101  

7650  350

101  

38460  1517

102  

10500  500

102  

7500 250

102  

17551  1120

102  

12400   400

103  

41500   550

103  

18670  1250

103  

6700  250

103  

17067  1018

Tips: 
• Make sure the input file exists prior to starting to process records.  If the file does not exist, end the program. 

• When we read the first record, we need to initialize a variable we will use to compare all following records against to see if the employee id has changed.  Typically, we complete this step prior to starting the loop which processes all subsequent records. 


• During normal processing, we accumulate a subtotal for the current sales person each time we loop.  When the key field changes (and the control break occurs), we print the subtotal, reset the subtotal to 0, and reset the variable used to compare all following records to the new id number just read in. 


• Once the last record is read in and the loop ends, we will need to perform one last subtotal line prior to printing summary totals. 

 Program 2(C++)


Summary: (Apartment problem) A real estate office handles, say, 50 apartment units. When the rent is, say, $600 per month, all the units are occupied.However, for each, say, $40 increase in rent, one unit becomes vacant. Moreover, each occupied unit requires an average of $27 per month for maintenance.How many units should be rented to maximize the profit?

Instructions: 

Write a program that prompts the user to enter:   
The total number of units.
The rent to occupy all the units.
Amount to maintain a rented unit.

The increase in rent that results in a vacant unit.
The program then outputs: The number of units to be rented to maximize the profit
The maximum profit   Since your program handles currency, make sure to use a data type that can store decimals with a decimal precision of 2.

support
close