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

11.2 Exercise 2: You are required to write a program that creates a float array of...
11.2 Exercise 2: You are required to write a program that creates a float array of size 90. Using a for loop, populate the array element whose index is the value of the loop variable with the value of the loop variable (e.g. array[0] = 0, array[1] = 1 etc.) Using a second loop display the loop index and the value in the array - each pair of numbers is to be displayed on a new line. Hi, could you...
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...
Write a program that prints the question “Do you wish to continue?” and reads the input....
Write a program that prints the question “Do you wish to continue?” and reads the input. If the user input is “Y”, “Yes”, “YES”, then print out “Continuing”. If the user input is “N” or “No”, “NO” then print out “Quit”. Otherwise, print “Bad Input”. Use logical operators. c++
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...
Exercise 18: Running Ex. 16 You will write exercise 16 into a program and make it...
Exercise 18: Running Ex. 16 You will write exercise 16 into a program and make it run. Note that there are two parts, 16A and 16B. Type 16A into a program called Exercise16A and type 16B into a program called Exercise16B. Be sure label each section using comments. You may notice that additional code needs to be written for the program to run. For example, Section I assumed that an array was already declared and initialized. Here, you will have...
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.
You are required to write a program to provide the statistics of a file (Number of...
You are required to write a program to provide the statistics of a file (Number of letters, number of words, number of vowels, number of special characters and number of digits. You should implement this problem as a class and call it FileContentStats which provides statistics about the number of letters, number of words, number of vowels, number of special characters, number of lines and number of digits. All of these should be private data members. (Should be in C++...
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...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT