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

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

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