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...
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...
Do the following lab by while or Do-while loop. question: Write a c++ program that asks...
Do the following lab by while or Do-while loop. question: Write a c++ program that asks students to enter 3 valid grades and then calculate the average and print it. if the user enters the invalid grade you should print the error message and get the new grade. Hint1: each time your program ask the following question: "Do you want to calculate another average?" and if the answer to this question is "Y" or "y" then you should continue. Hint2:...
For this assignment, you are required to write a MIPS program that reads its own instructions...
For this assignment, you are required to write a MIPS program that reads its own instructions and counts the number of occurrences of each type of instruction (R-type, I-type, or J-type). To accomplish this task, your program should execute the following steps: First, your program should load the address of its first instruction (0x400000) into a register, and initialize three separate instruction class counters to zero. Next, your program should enter a loop that reads each instruction from memory. For...
You are required to write an interactive program that prompts the user for two integers X...
You are required to write an interactive program that prompts the user for two integers X and Y and performs the following tasks: Adds two numbers Subtracts Y from X Multiplies X and Y Divides X by Y Finds which numbers is larger X oy Y) Prints all the results (a , b, c, d, and e) Program requirements: -     The program should run as many times as the users wish -     The program should be fully documented. -   ...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT