Answer to Question #219155 in C++ for Onai Maxwell

Question #219155
road accident is the number one killer in USA far exceeding that of HIV aids and COVID-19 put together. Most of the roads accidents are known to have been caused by driver negligence. Max of AiTSystem a software company advised that a system should be put in place to track the number of offenses committed by drivers. The system should be able to count the number of offenses committed by
each driver and make the following recommendations.

a. If a minor offense is committed by a driver, a fine of GHs 50 should be charged and the driver cautioned. A second minor offense by the same driver should
attract a fine of GHs 150 and the bared from driving for two weeks.
If the same driver commits more than two minor offenses, the driver’s license
should be confiscated and directed to go for retraining as a driver.

b. However, if a major offense is committed the driver should be investigated by DVLA.

c. On a trial bases, you are to develop a system to depict “a, and b’ above and
display the results
1
Expert's answer
2021-07-20T17:02:06-0400
#include<iostream>
using namespace std;
int getNumberOffences(){
	int n;
	cout<<"\nEnter the number of offences committed by the driver\n";
	cin>>n;
	return n;
}
int main(){
	string offence_type;
	double charge;
	cout<<"Enter the type of offence\n";
	cin>>offence_type;
	if(offence_type == "minor"){
	charge = charge + 50;
	int n = getNumberOffences();
	if(n == 2){
		charge  = charge + 150;
		cout<<"The driver is bared from driving for 2 weeks\n";
	}
	else if(n>2){
		cout<<"The driver license must be consficated and the driver must go for the retraining\n";
	}
	cout<<"The charge is  GHs "<<charge;
	}
	else if(offence_type == "major"){
		cout<<"The driver is investigated by the  DVLA\n";
	}
	
	
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS