Design a console application that will print the fine due for a citizen who was caught speeding in a 120km zone. Make use of an abstract class named Fine that contains variables to store the citizen name, speed and fine payable. Create a constructor that accepts the citizen name and speed as parameters and create get methods for the variables. The Fine class must also contain a method to calculate the fine. If the speed is greater than or equal to 120km, multiply the speed by R10.20, or else no fine if payable java netbeans
Q: Create a base class called Animal. All animals have a name (i.e. “Fido," “Thumper," "Princess,"…
A: Actually, program is an executable software that runs on a computer.
Q: a. Modify the FitnessTracker class that includes data fields for a fitness activity, the number of…
A: The answer is givenbelow:-
Q: Create a classstudent which includes parameters roll_no, name and address and consider as super…
A: //code import java.util.Scanner; class Student3 { void Student(int roll, String name,int…
Q: Design a console application that will print the fine due for a citizen who was caught speeding in a…
A: The required programs for the given criteria are as follows, File name: “iFine.java” public…
Q: Create another C++ class and call it Car. The Car class inherits form Vehicle class and has another…
A: #include <iostream>using namespace std; // to convert int to stringstring toString(int num){…
Q: In this exercise, you have to calculate the student's total marks using the concept of Classes…
A: Algorithm: Start Create a class named Student with name, mark1 and mark2 as its private attributes…
Q: Design a console application that will print a movie ticket for a customer. Make use of an abstract…
A: Given: public interface iTickets{public void print_tickets();}
Q: Create a base class called Insect. All insects have a color and a size. The size is measured in…
A: According to the information given:- We have to write to code to implement class insect and the…
Q: Referring to the UML class diagram given above, write codes in the main application that will do the…
A: Composition is a type of relationship between two or more classes. The composition indicates that…
Q: I need to create this coding: (JAVA PROGRAMMING) Write a program by creating an Employee class.…
A: Program: class Employee { String name; int hoursPerDay, salary; public void…
Q: Write code for an Invoice class for a car sale. Printing an object of the Invoice should print the…
A: 1.) The method signature is basically a declaration of the instance function in the base class so…
Q: Create a class named Employee including a constructor and the necessary accessor andmutator methods.…
A: // Employee.java public class Employee{ // attributes private String name; private String…
Q: Design a console application that will print the final result obtained by a student with the…
A: public interface iReport { public void print_report(); }
Q: Design a class called Flight that will store data about a commercial flight. Data includes:…
A: Begin Enter the details of the flight Display the details of the flight End
Q: Write a program in java that contains a class named pen. Data members include price and color.…
A: static methods or static variable can be directly accessed through class name. Code with output…
Q: Define a class named Billionaire which will be used to represent an entry on Forbes list of the…
A: stod - used to parse from string to double stoi - used to parse from string to integer
Q: Create a base class called Vehicle with name, max_speed, and tank_size attributes. Then create a…
A: The required Python code is given below: class Vehicle: name="" max_speed=0 tank_size=0…
Q: Design a console application that will print the cell phone bill of a customer. Make use of an…
A: Code is given below:
Q: Design a console application that will print the fine due for a citizen who was caught speeding in a…
A: ANSWER :
Q: Write a class HouseBuilder with private class members as houseArea(double, e.g. 20 square feet),…
A: using static System.Console; namespace ConsoleApp1 public class HouseBuilder { private double…
Q: Write a Java program that stores information about a company. You should define two classes:…
A: import java.util.*; class Department{ //definition of class department private String name;…
Q: Consider class Shape which is inherited by three classes Triangle, Circle and Square. Class Shape…
A: In this program we need to create 4 classes/ Shape: In shape class constructor will be able to find…
Q: For this question you will be implementing an inheritance-based system for medical drugs. The base…
A: Step 1:start 2: Create bade class Drugs with its datamembers and functions. 3: create MusculeRelaxer…
Q: In Java Write a CashRegister class that can be used with the RetailItem class that you wrote in…
A: The complete code is given below.
Q: Design a Java console application that will print the fine due for a citizen who was caught speeding…
A: EXPLANATION: - The interface iFine comprise of one abstract method named PrintFine. The abstract…
Q: Write all the code necessary for a class Truck. A Truck can be described as having a make (String),…
A: The code is given below.
Q: In this exercise, you have to create a class called Point which can calculate distance between two…
A: Here I ahve copied the code from the question and defined the methods and constructor to produce the…
Q: In java on netbeans design a console application that will print the fine due for a citizen who was…
A: public interface iFine { //declaring interface public void PrintFine(); //declaring abstract method}
Q: Write all the code necessary for a class Truck. A Truck can be described as having a make (string),…
A: An IllegalArgumentException is thrown to indicate an illegal argument has been passd to a method. It…
Q: Consider class Shape which is inherited by three classes Triangle, Circle and Square. Class Shape…
A: answer in step 2
Q: The interface Speaker is describe below. public interface Speaker{ public void speak(); public void…
A: // Speaker.java // Speaker Interface public interface Speaker { public void speak(); public…
Q: java-Design a class named Sandwich with data fields for description and price. Include a constructor…
A: Code: class Sandwich{ String description; double price; public Sandwich(String…
Q: java Prepare an abstract class SpecialColor with one property the color name (String) and two…
A: The three classes will be created as follows: Class SpecialColor This class has one attribute called…
Q: Write all code for a class Guitar as described here. A Guitaz can be described as having a number of…
A: public class Guitar{ public int numberOfStrings; public String manufacturer; public float…
Q: a. Add a nested class to Stock named Company. Company contains the following fields: (i) name, (ii)…
A: import dependencyanalysis.Stock.Company; public class StockTester { public static void…
Q: Design a console application that will print the fine due for a citizen who was caught speeding in a…
A: Import java.util.Scanner module for taking input from user. Define interface iFine with function…
Q: Write code for an Invoice class for a car sale. Printing an object of the Invoice should print the…
A: 1.) The method signature is basically a declaration of the instance function in the base class so…
Q: Write a class named Commission with the following features: O It extends the Hourly class. O It has…
A: Commission.java class is written below: public class Commission extends Hourly { //instance…
Q: Create a class called Polar for performing Polar coordinates. Define all the necessary variables to…
A: #include<iostream>#include<cmath>using namespace std; class Polar{ private: double…
Q: B) Create an interface named 'Figure' with an abstract void method 'shape()'. Now create two classes…
A: Below is the complete java program:
Q: Write a complete abstract class named Store with the following members: 1. Item number 2. quantity:…
A: public class Driver { public static void main(String[] args) { Items i=new Items(1, 15,…
Q: WRITE JAVA CODE FOR THE FOLLOWING Create a class named Pizza with the following data fields:…
A: In this code i have created two constructor to show the deliver charges one with greater than $15…
Q: Sanchez Construction Loan Co. makes loans of up to R100,000 for construction projects. There are two…
A: the code for the above requirement is
Q: Create an abstract class called Student. The student class includes a name and a Boolean…
A: Actually, program is a executable software that runs on a computer.
Q: First, define a class that represents a cube. The class must implement the following methods. init_0…
A: A Python program is as follows, File name: “main.py” class Cube: #Method _init_() def…
Q: Write an application that uses an abstract Insurance class and Health and Life subclasses to display…
A: public abstract class Insurance{ protected String type; protected double cost; public…
Q: Create a program in java Write a class named Employee that has the following fields: • name. The…
A: The code is written below in java: class Employee{ // Employee class private String…
OOPs
In today's technology-driven world, computer programming skills are in high demand. The object-oriented programming (OOP) approach is very much useful while designing and maintaining software programs. Object-oriented programming (OOP) is a basic programming paradigm that almost every developer has used at some stage in their career.
Constructor
The easiest way to think of a constructor in object-oriented programming (OOP) languages is:
Design a console application that will print the fine due for a citizen who was caught speeding in a
120km zone. Make use of an abstract class named Fine that contains variables to store the citizen
name, speed and fine payable. Create a constructor that accepts the citizen name and speed as
parameters and create get methods for the variables. The Fine class must also contain a method
to calculate the fine. If the speed is greater than or equal to 120km, multiply the speed by R10.20,
or else no fine if payable
java netbeans
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
- Write a program named SalespersonDemo that instantiates objects using classes named Real EstateSalesperson and GirlScout. Demonstrate that each object can use a SalesSpeech() method appropriately. Also, use a MakeSale() method two or three times with each object, and display the final contents of each objects data fields. First, create an abstract class named Salesperson. Fields include first and last names; the Salesperson constructor requires both these values. Include properties for the fields. Include a method that returns a string that holds the Salespersons full name—the first and last names separated by a space. Then perform the following Create two child classes of Salesperson: Real EstateSalesperson and Girl Scout. The Real EstateSalesperson class contains fields for total value sold in dollars and total commission earned (both of which are initialized to 0), and a commission rate field required by the class constructor. The Girl Scout class includes a field to hold the number of boxes of cookies sold, which is initialized to 0. Include properties for every field. Create an interface named ISell able that contains two methods: SalesSpeech() and MakeSale(). In each Real EstateSalesperson and Girl Scout class, implement SalesSpeech() to display an appropriate one- or two-sentence sales speech that the objects of the class could use. In the Real Estatesalesperson class, implement the MakeSale() method to accept an integer dollar value for a house, add the value to the Real EstateSalespersons total value sold, and compute the total commission earned. In the Girl Scout class, implement the MakeSale() method to accept an integer representing the number of boxes of cookies sold and add it to the total field.Design a console application that will print the fine due for a citizen who was caught speeding in a 120km zone. Make use of an abstract class named Fine that contains variables to store the citizen name, speed and fine payable. Create a constructor that accepts the citizen name and speed as parameters and create get methods for the variables. The Fine class must also contain a method to calculate the fine. If the speed is greater than or equal to 120km, multiply the speed by R10.20, or else no fine if payable. The Fine class must implement an iFine interface that contains the following: public interface iFine { public void PrintFine(); } Create a subclass called SpeedingFines that extends the Fine class. The SpeedingFines class must contain a constructor to accept the citizen name and speed as parameters. Write code for the PrintFine() method which displays the citizen name, speed and the total fine due. Finally write a SpeedingFineApplication class to capture the input and…Design a console application that will print the fine due for a citizen who was caught speeding in a 120km zone. Make use of an abstract class named Fine that contains variables to store the citizen name, speed and fine payable. Create a constructor that accepts the citizen name and speed as parameters and create get methods for the variables. The Fine class must also contain a method to calculate the fine. If the speed is greater than or equal to 120km, multiply the speed by R10.20, or else no fine if payable. 18; 19; 20 2020 © The Independent Institute of Education (Pty) Ltd 2020 Page 6 of 7 The Fine class must implement an iFine interface that contains the following: public interface iFine { public void PrintFine(); } Create a subclass called SpeedingFines that extends the Fine class. The SpeedingFines class must contain a constructor to accept the citizen name and speed as parameters. Write code for the PrintFine() method which displays the citizen name, speed and the total fine…
- Design a Java console application that will print the fine due for a citizen who was caught speeding in a120km zone. Make use of an abstract class named Fine that contains variables to store the citizenname, speed and fine payable. Create a constructor that accepts the citizen name and speed asparameters and create get methods for the variables. The Fine class must also contain a methodto calculate the fine. If the speed is greater than or equal to 120km, multiply the speed by R10.20,or else no fine if payable. The Fine class must implement an iFine interface that contains the following:public interface iFine{public void PrintFine();}Create a subclass called SpeedingFines that extends the Fine class. The SpeedingFines class mustcontain a constructor to accept the citizen name and speed as parameters. Write code for thePrintFine() method which displays the citizen name, speed and the total fine due.Finally write a SpeedingFineApplication class to capture the input and instantiate…Question 2 (Marks: 30) Write a Java console application to print a report and determine if a hospital is due for a health inspection. Make use of an abstract class named Inspection that contains variables to store the hospital location, hospital name and the years since the last inspection. This class also creates methods to get the hospital location, name, and years since the last hospital inspection by using the get methods. Create a constructor that accepts the hospital location, name and years since the last inspection as parameters. The Inspection class must implement an iInspection interface that contains the following: interface iInspection { public String getLocation(); public String getHospitalName(); public int getYearsSinceInspection(); public String getInspectionNeeded(); } Create a subclass called Hospital Inspections that extends the Inspection class. The Hospital Inspection class must contain a constructor to accept…Write a tester program to test the mobile class defined below. Create the class named with your id (for example: Id12345678) with the main method. Create two mobiles M1 and M2 using the first constructor. Print the characteristics of M1 and M2. Create one mobile M3 using the second constructor. Change the id and brand of the mobile M3. Print the id of M3. The programming language I'm using is Java. So, it'll be much appreciated if the answer was in Java. Thanks.
- Question 2 In java on netbeans design a console application that will print the fine due for a citizen who was caught speeding in a 120km zone. Make use of an abstract class named Fine that contains variables to store the citizen name, speed and fine payable. Create a constructor that accepts the citizen name and speed as parameters and create get methods for the variables. The Fine class must also contain a method to calculate the fine. If the speed is greater than or equal to 120km, multiply the speed by R10.20, or else no fine if payable. The Fine class must implement an iFine interface that contains the following: public interface iFine { public void PrintFine(); } Create a subclass called SpeedingFines that extends the Fine class. The SpeedingFines class must contain a constructor to accept the citizen name and speed as parameters. Write code for the PrintFine() method which displays the citizen name, speed and the total fine due. Finally write a SpeedingFineApplication class to…Write a tester program to test the mobile class defined below. Create the class named with your id (for example: Id12345678) with the main method. Create two mobiles M1 and M2 using the first constructor. Print the characteristics of M1 and M2. Create one mobile M3 using the second constructor. Change the id and brand of the mobile M3. Print the id of M3. The programming I'm using is java. So, I'll be much appreciated if the answer was in java plus, Can you solve with the entry below? public class Mobile { private int id; private String brand; public Mobile() { id = 0; brand = ""; } public Mobile(int n, String name) { id = n; brand = name; } public void setBrand(String w) { brand = w; } public void setId(int w) { id = w; } Public int getId() { return id; } public String getBrand() { return brand; } }JAVA - USING CONSTRUCTORS Create a class named House that includes data fields for the number of occupants and the annual income as well as methods named setOccupants(), setIncome(), getOccupants() and getIncome() that set and return those values respectively. Additionally, create a constructor that requires no arguments and automatically sets the occupants field to 1 and income field to 0. Create an additional overloaded constructor . This constructor receives an integer argument and assigns the value to the occupants field. Create a third overloaded constructor this time, the constructor receives 2 arguments, the values of which are assigned to the occupants and income fields respectively. Create another class named I_house that instantiates the House class and see if the constructors work correctly.
- Write a tester program to test the mobile class defined below. Create the class named with your id (for example: Id12345678) with the main method. Create two mobiles M1 and M2 using the first constructor. Print the characteristics of M1 and M2. Create one mobile M3 using the second constructor. Change the id and brand of the mobile M3. Print the id of M3. Your answer should include a screenshot of the output. Otherwise, you will be marked zero for this question. public class Mobile { private int id; private String brand; public Mobile() { id = 0; brand = ""; } public Mobile(int n, String name) { id = n; brand = name; } public void setBrand(String w) { brand = w; } public void setId(int w) { id = w; } Public int getId() {This is the question - Write an application that uses an abstract Insurance class and Health and Life subclasses to display different types of insurance policies and the cost per month. The Insurance class contains a String representing the type of insurance and a double that holds the monthly price. The Insurance class constructor requires a String argument indicating the type of insurance, but the Life and Health class constructors require no arguments. The Insurance class contains a get method for each field; it also contains two abstract methods named setCost() and display(). The Life class setCost() method sets the monthly fee to $36, and the Health class sets the monthly fee to $196. Code I was given - import java.util.*; public class Health extends Insurance { public Health() { // write your code here } public void setCost() { // write your code here } public void display() { // write your code here } } public…Sanchez Construction Loan Co. makes loans of up to R100,000 for construction projects. There aretwo categories of Loans—those to businesses and those to individual applicants. Write anapplication that tracks all new construction loans. The application also must calculate the totalamount owed at the due date (original loan amount + loan fee). The application should includethe following classes:•• Loan—A public abstract class that implements the LoanConstants interface. A Loan includes aloan number, customer last name, amount of loan, interest rate, and term. The constructor requiresdata for each of the fields except interest rate. Do not allow loan amounts greater than R100,000.Force any loan term that is not one of the three defined in the LoanConstants class to a short-term,1-year loan. Create a toString() method that displays all the loan data.•• LoanConstants—A public interface class. LoanConstants includes constant values for short term(1 year), medium-term (3 years), and long-term…