Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Programming Assignment 5a -Design Ballistic Table Program Your assignment is to

ID: 3591679 • Letter: P

Question

Programming Assignment 5a -Design Ballistic Table Program Your assignment is to design a program that computes and displays five (5) ballistic tables. This is the first of a two-part assignment. The second part, 5b, will be to implement and test the program for this design This program will display the range that a ball would travel when it is thrown with an initial velocity, w at an angle, e, degrees DO loops are roquired to solve this problem. Do not unnecessarily duplicate code. One table should be calculated for each of the initial velocities: 0, 1, 10,100, and 1000 meters per second. The should provide for each of these cases The table should have one row for every 5 degrees for angles between 5 and 85 degrees inclusive. This can be accomplished by a counter controlled inner loop. Note that this assignment does not require a READ statement since all data required can be constructed into the program. appropriate headings. White space should separate the tables. Do not use for the program. result of a properly designed and implemented program for this function has been provided. our assignment is to create the design that will reproduce this result. When your design is completed the specified output should match the results file provided. s always, your program must conform to the Assignment Submission Requirements for design we assume negligible air friction and ignore the curvature of the earth, a ball that is thrown the air from any point on the earth's surface will follow a parabolic flight path , integer counter, lnit , fnaleg 5, sttp: thd do

Explanation / Answer

#include<fstream>

#include<iostream>

#include<iomanip>

using namespace std;

class payroll{

ifstream fin;

char employeeid[12];

char employeename[20];

char maritalstatus;

int hoursworked,overtime;

double hourlyrate,overtimepay,regularpay,grosspay,taxrate,taxamount,netpay;

void calculategrosspay();

void calculatetax();

void calculatenetpay();

void printheadings();

void printdata();

public:payroll();

~payroll();

void printreport(); };

payroll::payroll(){

fin.open("payroll.dat"); }//CONSTRUCTOR

payroll::~payroll(){

fin.close(); }//DECONSTRUCTOR

void payroll::calculategrosspay(){

if(hoursworked>40){

overtime=hoursworked-40;

regularpay=hoursworked*hourlyrate;

overtimepay=overtime*(hourlyrate*1.5);

grosspay=regularpay+overtimepay; }//IF

else grosspay=hoursworked*hourlyrate; }//CALCULATEGROSSPAY

void payroll::calculatetax(){

if(grosspay>=500)taxrate=.30;

else if(grosspay>200)taxrate=.20;

else taxrate=.10;

if(maritalstatus=='S'||maritalstatus=='s')

taxrate=taxrate+.05;

taxamount=grosspay*taxrate;}//CALCULATETAX

void payroll::calculatenetpay(){

netpay=grosspay-taxamount;}//CALCULATENETPAY

void payroll::printheadings(){

cout<<setw(45)<<"-PAYROLL REPORT-"<<endl;

cout<<"-----------------------------------"<<endl;

cout<<"NAME ID HW OT RT-PAY OT-PAY GROSS TAX NET"<<endl;

cout<<"------------------------------------------------"<<endl;

}//PRINTHEADINGS

void payroll::printdata(){

cout<<setprecision(2)<<setiosflags(ios::fixed|ios::showpoint);

cout<<setw(6)<<employeename<<setw(12)<<employeeid<<setw(4)<<hoursworked

<<setw(3)<<overtime<<setw(8)<<regularpay<<setw(8)<<overtimepay<<setw(8)

<<grosspay<<setw(8)<<taxamount<<setw(8)<<netpay<<endl; }//PRINTDATA

void payroll::printreport(){

int i=0;

printheadings();

while(fin>>employeename>>employeeid>>maritalstatus>>hoursworked>>hourlyrate){

calculategrosspay();

calculatetax();

calculatenetpay();

printdata();

i++; }//WHILE

}//PRINTREPORT

int main(){

payroll employee;

employee.printreport();

return 0;

}//MAIN