Question

In: Computer Science

Question 1 In this exercise, you are required to do a program analysis and write a...

Question 1 In this exercise, you are required to do a program analysis and write a program for a system that computes a speeding ticket cost. The charge is calculated as follows: P20 for every kilometre above the speed limit, plus P100 standard charge. E.g. If the speed limit is 60 km/hour and you are driving at 75 km/hour. The charge will be P400. If the speed is equal to or under the speed limit, then there is no charge. However, if the speed is over 220 km/hour in a 60 km zone the license is immediately revoked plus P3000 pula fine, but if it is the driver’s birthday the ticket will be forgiven and cost nothing. The output should be both to the screen and word document file. Required: Part A: Documentation Compile a well-structured report that contains the following information. 1. Problem definition 2. System Requirements 3. Flowchart for the system 4. Results and Discussions 5. Conclusions 6. Referencing [50 marks] Part B: C++ Program Write a C++ program for the system. Assessment will be through demonstration. [50 marks]

Solutions

Expert Solution

main.cpp

#include <iostream>

using namespace std;

int main() {

int limit,speed;

cout<<"Welcome to Speed Ticketing"<<endl;

cout<<"Please enter the speed limit: "<<endl;

cin>>limit;

cout<<"Please enter the speed you were driving at: "<<endl;

cin>>speed;

int finalSpeed = speed-limit;

cout<<"Is today your birthday?(Please answer 'Y-for Yes' or 'N-No')"<<endl;

char ch;

cin>>ch;

if (ch == 'N'){

if(speed>limit){

if(finalSpeed>=160){

cout<<"Your licence is being revoked along with a fine of P3000."<<endl;

}

else{

int fine = (finalSpeed*20) + 100;

cout<<"You are fined with total: P"<<fine<<endl;

}

}

}

else{

cout<<"You are good to go!!!!"<<endl;

}

}

Output:


Related Solutions

Write program for the exercise 11(Sales Analysis) as explained at the end of the chapter. 11....
Write program for the exercise 11(Sales Analysis) as explained at the end of the chapter. 11. sales Analysis The file SalesData.txt, in this chapter’s source code folder, contains the dollar amount of sales that a retail store made each day for a number of weeks. Each line in the file contains seven numbers, which are the sales numbers for one week. The numbers are separated by a comma. The following line is an example from the file: 2541.36,2965.88,1965.32,1845.23,7021.11,9652.74,1469.36 Write a...
Question 1 Required: a) . Discuss the objective of financial statement analysis. (5 Marks) b) Do...
Question 1 Required: a) . Discuss the objective of financial statement analysis. b) Do you think financial reporting plays any role in the capital markets? Explain in your own words. c) . Why do you think it is important to review the strategy of a company before and after completing a financial statement analysis? Explain. d). The following note appears in the financial statements of a company: “The financial statements have been prepared on the historical cost basis, except for...
You are supposed to write Java program for the following questions. For every question, do provide...
You are supposed to write Java program for the following questions. For every question, do provide at least THREE (3) different test cases. Question 1 Modify question 3 of Assignment 1 to accept a telephone number with any number of letters. The output should display a hyphen after the first 3 digits and subsequently a hyphen (-) after every four digits. Also, modify the program to process as many telephone numbers as the user wants.
1. Write pseudocode for the following program. You do not have to write actual C++ code....
1. Write pseudocode for the following program. You do not have to write actual C++ code. Assume you have a text file, that has been encrypted by adding 10 to the ASCII value of each character in the message. Design a decryption program that would reverse this process, and display the original message to the console.to the new array. 2.Write the code for the specified program. Use proper style and naming. Test and upload your code as a CPP file....
I have to do the following MIPS coding assignment. Question 1 Write a MIPS program that...
I have to do the following MIPS coding assignment. Question 1 Write a MIPS program that meets the following requirements (NOTE: your program statements should follow the order of the requirements and each requirement should correspond to only one assembly instruction): Loads the hexadecimal equivalent of 23710 into register 13 using an immediate bitwise OR instruction Loads the hexadecimal equivalent of 183410 into register 17 using an immediate bitwise OR instruction Performs the bitwise AND operation on the operands stored...
You are to write a program in C to do the following in a loop for...
You are to write a program in C to do the following in a loop for the KL46Z . Prompt the user for a positive integer greater than 1 and sanity-check the input. If the number is a prime number, it is to be printed on a new line in red text. If the number is evenly divisible by 7, it is to be printed on a new line in green text. If the current number is evenly divisible by...
Please do this in java program. In this assignment you are required to implement the Producer...
Please do this in java program. In this assignment you are required to implement the Producer Consumer Problem . Assume that there is only one Producer and there is only one Consumer. 1. The problem you will be solving is the bounded-buffer producer-consumer problem. You are required to implement this assignment in Java This buffer can hold a fixed number of items. This buffer needs to be a first-in first-out (FIFO) buffer. You should implement this as a Circular Buffer...
C++ for Mac (Xcode) For this exercise, you will write a program that includes four function...
C++ for Mac (Xcode) For this exercise, you will write a program that includes four function definitions. You will also write a main() function that calls these four functions to demonstrate that they work as expected. The four functions are: 1. printExitMessage() : This function prints a message to the screen saying something like "Thanks for using this software. Goodbye." 2. getMin(): This function takes two float inputs and returns the lesser of the two float values. For example, if...
Instructions Write a program to implement the algorithm that you designed in Exercise 19 of Chapter...
Instructions Write a program to implement the algorithm that you designed in Exercise 19 of Chapter 1. Your program should allow the user to buy as many items as the user desires. Instructions for Exercise 19 of Chapter 1 have been posted below for your convenience. TEXT ONLY PLEASE (PLEASE NO PDF OR WRITING) C++ CODE Exercise 19 Jason typically uses the Internet to buy various items. If the total cost of the items ordered, at one time, is $200...
CODE IN C++ PLEASE Write a program to implement the algorithm that you designed in Exercise...
CODE IN C++ PLEASE Write a program to implement the algorithm that you designed in Exercise 19 of Chapter 1. Your program should allow the user to buy as many items as the user desires. Instructions for Exercise 19 of Chapter 1 have been posted below for your convenience. Exercise 19 Jason typically uses the Internet to buy various items. If the total cost of the items ordered, at one time, is $200 or more, then the shipping and handling...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT