Calculate and notify violators of the fines

Assignment Help JAVA Programming
Reference no: EM131565553

Java program that can be used to calculate and notify violators of the fines and/consequences for road traffic breaches as shown in the schedule below.

The violation notice may comprise of any of the following:

- One or more of non-moving violations alone.
- Combination of non-moving violations, and one kind of moving violation for excess speeding, or speeding in construction zone, but not both.
- Combination of non-moving violations, and one kind of moving violation for speeding in school zone, or speeding in toll facility, but not both.

Non-Moving Violation
- No driver's license $25.00
- Expired tag $20.00
- No registration $20.00
- No insurance $10.00

Moving Violation
-Speeding violation or speeding in construction zone Miles over the Speed Limit o 1 - 5 MPH Warning o 6 - 9 MPH $130.00 o 10 - 14 MPH $205.00 o 15 - 19 MPH $405.00 o 20 - 29 MPH $455.00 o 30 MPH or over $605.00 and court appearance
-Speeding in school zone or speeding within a toll facility o 1 - 5 MPH $155.00 o 6 - 9 MPH $255.00 o 10 - 14 MPH $305.00 o 15 - 19 MPH $405.00 o 20 - 29 MPH $455.00
2

-One kind of moving violation only, for excess speeding, or speeding in construction zone, but not both.
-One kind of moving violation for speeding in school zone, or speeding in toll facility, but not both.

In formulating your solution: (a) class called TrafficViolations that determines types of traffic violations. (b) test class called TestTrafficViolations that implements the class TrafficViolations (c) Demonstrate knowledge of the if statement and the switch statement by using the if/else statement to determine the miles, and the switch statement for the other criteria. (d) You determine a suitable format for the output

This is what I have so far...

import java.util.*;
import java.lang.*;
import java.io.*;
class TrafficViolations
{
public static void trafficviolation()
{
int speed;
int lic;
int registration;
int insurance;
double fine =0;
double sfine=0;
int location;

Scanner scan = new Scanner(System.in);
System.out.println(" Do you have license (1/0) 1 for yes or 0 No ( for No driver license $25.00)");
lic=scan.nextInt();
System.out.println(" Tag expired (1/0) 1 for yes or 0 No ( for Expired tag $20.00)");
int tag=scan.nextInt();
System.out.println(" Do you have No Registration (1/0) 1 for yes or 0 No ( No registration $20.00)");
registration=scan.nextInt();
System.out.println(" Do you have Insurance(1/0) 1 for yes or 0 No (No insurance $10.00)");
insurance=scan.nextInt();
//Moving Violation
//Speeding violation or speeding in construction zone
System.out.println(" Enter Speed ");
speed =scan.nextInt();
System.out.println(" Enter location (Enter 1/0) if school area 1 otherwise zero ");
location= scan.nextInt();
if(lic==0)
{
fine=fine+25;
}
if(insurance==0)
{
fine=fine+10;
}
if(registration==0)
{
fine=fine+20;
}
//Miles 0ver the Speed Limit
if (speed>1 &&speed <=5 )
{
System.out.println("Warning: Miles Over the Speed Limit please drive below the speed limit");
}
if (speed>6 &&speed <=9 )
{
sfine=sfine+130.00;
}
if(speed>10 && speed <=14 )
{
sfine=sfine+205.00;
}
if(speed>=15 && speed<=19 )
{
sfine=sfine+405.00;
}
if (speed>20 && speed<=29 )
{
sfine=sfine+455.00;
}
if (speed>30 )
{
sfine=sfine+605.00;
System.out.println(" Court appearance needed if speed is more than 30");
}
//Speeding in school zone or speeding within a toll facility
if (speed>1 &&speed <=5 && location ==1)
{
sfine=sfine+155.00;
System.out.println("Warning: Miles Over the Speed Limit please please drive below the speed limit");
}
if (speed>6 && speed <=9 && location ==1 )
{
sfine=sfine+255.00;
}
if (speed>10 && speed <=14 && location ==1 )
{
sfine=sfine+305.00;
}
if (speed>15 && speed <=19 && location ==1)
{
sfine=sfine+405.00;
}
if (speed>20 && speed <=29 && location ==1)
{
sfine=sfine+455.00;
}
System.out.println("Fine for Non Moving ViolationFine"+fine);
System.out.println("Fine for Moving ViolationFine"+sfine);
System.out.println("Fine for Non Moving+Moving ViolationFine"+(fine+sfine));
}
}

Reference no: EM131565553

Questions Cloud

Concept of object oriented programming : What is the significance of the concept of inheritance within the concept of object oriented programming?
Elaborate on ways that social media platforms can proactive : Suggest and elaborate on three ways that social media platforms can be more proactive and thorough with their review of the types of content that appear on thei
Create java application that implements use of an int array : Create a Java application that implements use of an int array. Use for loops to iterate through the array using the array's length variable to stay
What is the current economic situation for ucco : What is the current economic situation for UCCO? What suggestions can Barbara make to help mitigate financial issues?
Calculate and notify violators of the fines : Java program that can be used to calculate and notify violators of the fines and/consequences for road traffic breaches
Specify the variation nature of the project in question : Select one project from the working or educational environment of your choice and specify the variation nature of the project in question.
Find the displacement as a function of t : An object at the end of a spring is immersed in liquid. Its velocity (in cm/s) is then described by the equation v = 2e-2x + 3e-5t, where t is the time (in s).
Find the velocity v of a falling brick in terms of the time : When we consider the resisting force of the air, the velocity v (in ft/s ) of a falling brick in terms of the time (in s) is given by dv/(32 - 0.5v) = dt.
Simple java programming tests : The java coding that accepts a distance it kilometers, sends it to a method which converts it to miles, and then displays the result

Reviews

Write a Review

JAVA Programming Questions & Answers

  User enter a series of numbers

Design a java program with a loop that lets the user enter a series of numbers. The user should enter - 99 to signal the end of the series. After all the numbers have been enter been entered, the program should display the largest and smallest number..

  In java programming what is the size of double variable

In java programming What is the size of double variable?

  Modify existing javascript code to extend its functionality

Modify existing JavaScript code to extend and alter its functionality and, where appropriate, to correct errors and cases of poor practice.

  Program that prompts the user to enter the year and display

Write a program that prompts the user to enter the the year and first day of the year and displays the calendar table for the year on the console. For example , if the user entered the year 2013, and 2 for tuesday, January 1, 2013, your program shoul..

  It inherits the functionality of super class

It inherits the functionality of super class Package and contains an additional data member representing an additional fee per ounce charged for overnight-delivery service.

  Design and develop mobile web application

HC2051 Mobile Web Applications Development. In this group assignment (maximum 5 students) requirement, you are required to design and develop mobile web application using any or all of the techniques you have learned in the class for example: HTML,..

  Write a java tcp socket program to do tcpsocket server

Write a Java TCP socket program to do TCPSocket server. When starts the server, IP address of the machine must be displayed so the client can use to connect.

  Java application prompt user to put in integer from keyboard

Write a java application that performs the following task: prompt user to put in an integer from the keyboard, search for the user input from the array created in step 1.

  Mean and standard deviationwrite a program that reads a set

mean and standard deviation.write a program that reads a set of floating-point data values from the input. when the

  Build a software simulation of a dvd player

CMPT270 Intersession 2017 Assignment - Design and then build a software simulation of a DVD player that also has WIFI capability

  Can you provide the output of this program

Can you provide the output of this program - What is the output of following JavaScript code?

  Define the determinant of a matrix

Define the determinant of a matrix a (written det(a)) recursively as follows: if a is a 1 x 1 matrix, then det(a) = x

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd