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.
Q: Write a java program named MyLoan that uses an abstract class named FamilyInsurance and subclasses…
A: The complete code is given below with the output.
Q: Create a class named 'Member' having the following members: Data members 1 - Name 2 - Age 3 - Phone…
A: EXPLANATION - A class employee is created and which inherit class member and declare…
Q: Movable «interface>> +moveUp(): void +moveDown (): void +moveleft():void +moveRight():void abstract…
A: Movable.java public interface Movable { void moveUP(); void moveDown(); void moveLeft();…
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: A class Person is given below as your base class. Your task is to create a class Employee which will…
A: The solution to the given problem is below.
Q: Please someone help me how can i use java to create an abstract class called Worker and 2 subclasses…
A: public abstract class Worker { //declaring protected members protected String name; protected int…
Q: Write some Java code involving if, else if, and else statements that are equivalent to the following…
A: As per guidelines we are supposed to answer only one question. Kindly repost other questions as a…
Q: PLZ help with the following: IN JAVA The following classes are defined: ELDevice, fridge, Computer,…
A: Approach: Inheritance in java : Inheritance is a mechanism in java where one derived class…
Q: Write a tester program to test the mobile class defined below. Create the class named with your id…
A: Create the class named with your id (for example: Id12345678) with the main method. Create two…
Q: 2. Create a class named 'Member' having the following members: Data members 1 - Name 2 - Age 3 -…
A: public class Member{ //declaring instance variables private String name; private int age;…
Q: The goal of this assignment is to show a simple implementation of inheritance and polymorphism in…
A: Program Plan:- 1. Create two classes Patient and Billing. 2. The objects of these classes are the…
Q: Build an abstract class named Salary that has the following: -One abstract method named…
A: Code: abstract class Salary{ abstract void calculateSalary(); void MinimumSalary() {…
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: Write a java program named MyLoan that uses an abstract class named FamilyInsurance and subclasses…
A: Java is a programming language originally developed by James Gosling at Sun Microsystems (which is…
Q: Write a tester program to test the mobile class defined below. Create the class named with your id…
A: public class Id12345678{ public static void main(String[] args) { //Creating M1 and M2 using…
Q: Java Programming Using seriazation in java Create a class named CellPhone implementing that has 4…
A: Answer: Java Source Code: CellPhone.java: public class CellPhone implements java.io.Serializable{…
Q: Write an abstract class called A and a second class called B which inherits from A. Class A will…
A: Your C# code is here given below with an output.
Q: There is an Admission class that assigns the admission id and registration number to the Student.…
A: The ask is to do the following: - create an Admission class that assigns the admission id and…
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: 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: The atoms of different elements have different numbers of protons, neutrons and electrons. Electrons…
A: Required: Electrons are negatively charged, protons are positively charged, and neutrons have no…
Q: In java Create an abstract super class called Employee with the following attributes: name :…
A: Hey there, I am writing the required solution based on the above given question. Please do find the…
Q: Given the following Imagine that is attached, select that all apply A. If the Other class extends…
A: When Other class extending Base class, then Other class becomes Child class where as Base class…
Q: Inheritance through an extended (derirved) class supports which of the following concepts? a)…
A: The idea of a legacy in Programming language is that you can create new classrooms built on…
Q: Write a Java class name "Student", you have to get all the student's detail required to calculate…
A: Create the class Student as follows: The data members are – name, roll number, number of courses,…
Q: Consider class Shape which is inherited by three classes Triangle, Circle and Square. Class Shape…
A: answer in step 2
Q: It has just one Main class which tests abstract class Animal and its 3 subclasses: Dog, Cat, and…
A: //declaring interfacepublic interface Talker{ //declaring abstract methods public void…
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: Mango is a well-known delicious fruit, which are different in type, name, color, size, sweetness,…
A: Create objects of this Mango class in another class Main for testing
Q: It has just one Main class which tests abstract class Animal and its 3 subclasses: Dog, Cat, and…
A: Question given: A program code is given of driver class. Write all classes and their method that…
Q: QI. Inheritance System A/ Write the java code of the interface IComputer that contains the…
A: In questions with many questions, we must do 1.
Q: ou need to write the complete code as mentioned below: i) The main class with necessary codes.…
A: Summary:In this question, we need to create a superclass, subclass, and test class to test the…
Q: Write a java program named MyLoan that uses an abstract class named FamilyInsurance and subclasses…
A: As you asked to find at least 5 relevant elements for each of insurance The given insurances are…
Q: Create a base class with an abstract print( ) method that is overridden in a derived class. The…
A: Program approach: Creating an abstract base class named as Base Creating an abstract method inside…
Q: It is required to develop an application in Java to perform some operations to store information…
A: Given:
Q: Q3. Write a Java program to implement the concept of run time polymorphism through method overriding…
A: Code Music.java// class representing musicpublic class Music { // member to hold the title…
Q: Suppose you are working on a project managing the bus fare of Dhaka metropolitan city. At this point…
A: Answer: Our instruction is answer the first three part from the first part I have done code as well…
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: JAVA) Create a class hierarchy to represent the different types of employees in an office who have…
A: Algorithm: Start Create an abstract class named Employee with attributes name, enrollment and…
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: Write an abstract Java class named Vehicle. It has two attributes grade(private) and…
A: abstract methods has to be implemented in child classes and the respective classes will be called
Q: Create a base class and also a class that is derived from the base class. The base class needs to…
A: Program: #include <iostream> #include <iomanip> using namespace std; //Animal…
Q: Java Program There is a company who known for its courier service. They have service namely Basic,…
A: import java.util.*; class courier{ String…
Q: Write a program IN C# named SalespersonDemo that instantiates objects using classes named…
A: Answer :
Q: 2. A software firm has mainly two types of employces: Fulltime employees get basic pay, medical…
A: Hey there, I am writing the required solution of the above stated question.Please do find the…
Q: a. Create a java class named RawMaterial. b. Add the following fields to the RawMaterial class. Note…
A: As our company guidelines we are supposed to answer only one question per post and kindly resubmit…
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 capture the input and instantiate the
SpeedingFines class.
Step by step
Solved in 5 steps with 1 images
- Code in Java Define a class named MobilePhone with the attributes brand name, model, color and price. Define 3 constructors - the first one is the default constructor, the second one initializes all data members and the third one gives an initial value to the brand name Apple, model iPhone XR and price to 54250 while allowing color to be initialized by the user. Also, write a display method that prints in this manner: Brand: Samsung Model: S10 Color: Black Price: 53300.0 Write a method updatePrice that updates the price of the mobile phone. The method accepts a price. If the value of the price is negative the price must be deducted with the value. But if positive price must be added with the value. It will not allow update of price if will result to a negative value for price. For example: Test Result MobilePhone phone = new MobilePhone("Samsung", "S10", "Black", 53300.00); phone.display(); Brand: Samsung Model: S10 Color: Black Price: 53300.0…Java Programming Using seriazation in java Create a class named CellPhone implementing that has 4 data members - load, talkTime (min), ratePerMinute, ratePerText . Define 3 constructors - one is the default constructor , second a constructor that would initialize all the attributes , and third is a constructor that allows the user to initialize all the attributes except the load, instead, directly set load to 300. Also, define getter and setter methods for all attributes.Implement these methods : (1) callCost that would return the total cost of the call based on the parameter 'duration' (2) canCall method that returns true if parameter 'duration' (in min) is less than or equal to the available 'talkTime' and you have enough load to complete the call. [HINT: call callCost method and deduct the talkTime] (3) isLowBat method that returns true if the talkTime is equal to zero (4) canText method that reduces the load by its ratePerText and returns true if text is successfully…An employee has a name, phone number and salary. A coach is a person with a senitority status, one of: junior, lead, and senior. Define the possible status values as constants. A staff is a person with a job title and job descrption. Your programming task is to Implement as abstract class named Employee and two subclass name Coach and Staff in Java as defined above Provide constructors for classes to initalize private variable Override the toString() method in each of the classes in task 1 to display the class name and the person's name Write an application to create objects of type Coach and Staff and print the person's name and the class name of the objects
- 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; } }1). Write a java abstract class called Solid and you will derive two classes – Cylinder and Sphere – from Solid. The class Solid Member variables type whose data type is String. For example, the type could be sphere, cube, parallelepiped. 2). The methods should include: A default or null constructor A constructor that initializes the value of type Getters and Setters An abstract method to find volume whose signature is public abstract double findVolume(); An abstract method to find surface area whose signature is public abstract double findSurfaceArea() a toString method that returns a string like the following Solid Type: Sphere an equals method that returns true if two Solid objects have the same type and false otherwise. 3). The class Cylinder - Cylinder will extend Solid Member variables: Cylinder inherits type from Solid radius of type double height of type double Methods: a default or null constructor a constructor that initializes type, radius, and height. type will always…1). Write a java abstract class called Solid and you will derive two classes – Cylinder and Sphere – from Solid. The class Solid Member variables type whose data type is String. For example, the type could be sphere, cube, parallelepiped. 2). The methods should include: A default or null constructor A constructor that initializes the value of type Getters and Setters An abstract method to find volume whose signature is public abstract double findVolume(); An abstract method to find surface area whose signature is public abstract double findSurfaceArea() a toString method that returns a string like the following Solid Type: Sphere an equals method that returns true if two Solid objects have the same type and false otherwise. 3). The class Cylinder - Cylinder will extend Solid Member variables: Cylinder inherits type from Solid radius of type double height of type double Methods: a default or null constructor a constructor that initializes type, radius, and height. type will always…
- Create a base class with an abstract print( ) method that is overridden in a derived class. The overridden version of the method prints the value of an int variable defined in the derived class. At the point of definition of this variable, give it a nonzero value. In the base-class constructor, call this method. In main( ), create an object of the derived type, and then call its print( ) method. Explain the results. (JAVA)In java Create an abstract super class called Employee with the following attributes: name : String and the following methods getter and setter for the one attribute three constructors an abstract method called getSalary() equals() toString() Create a sub class of Employee called Faculty with the following attribute yearlyPay : double department: String and the following methods getter and setter for the attributes three constructors getSalary() that returns the yearlyPay divided by 52 equals() toString() Create a sub class of Employee called Staff with the following attributes: hoursWorked : double payrate : double and the following methods getters and setters for the two attributes three constructors getSalary() that returns the weekly pay (multiply hoursWorked by payrate, overtime included and 1.5 times payrate for hours > 40) equals() toString() Create a sub class of Employee called Sales with the following attributes: salesAmount : double //sales per week…write all the code necessary for a class Toaster as described here. A toaster can be described as having a model (string), manufacture(string), and price. include the following methods in your class definition.(in java) 1. a default constructor2. an overloaded constructor takes the model and manufacture as input.3. an accessor method to acquire the price.4. a tostring method that returns a reasonable description of the toaster.
- Java Program There is a company who known for its courier service. They have service namely Basic, TwoDayPackage and OvernightPackage.Create a base class Package has the following: It has three attributes type Person sender, Person receiver, int weight Encapsulate the fields Override toString and Equals of the Object class Define calculateCost with a return type of double as abstract Create the following constructors- default constructor- constructor that accepts attribute sender, receiver, and weight- constructor that accepts two name, two address, two phone numbers and weight NOTE: Person has the following attributes: String name, String address, and String phone numberThe total cost of a group of items at a grocery store is based on the sum of the individual product prices and the tax (which is 5.75%). Products that are considered “necessities” are not taxed, whereas products that are considered “luxuries” are. The Product class is abstract, and it has a method called getTotalPrice. Your task is to create two subclasses of Product: NecessaryProduct and LuxuryProduct and implement the getTotalPrice method in each of these classes appropriately. Then modify the driver program to instantiate four products (two necessary and two luxury) and store them in the product array, print out each item in the array, and display the total cost of the items. You should not make any changes at all to Product.java, and you should only add to ShoppingTripStartingCode.java. Do not change any code that is already present Example(Cheese and bread are necessities and soda and candy are luxuries)Cheese…The interface Speaker is describe below. public interface Speaker{ public void speak(); public void announce(String str); } Create classes Dog and Philosopher implementing the Speaker interface. (The code for the general overview of the classes are provided you just need to fill the method and class headers and their code) and then create a driver class showing the abilities of interface, these tests are includes the ability of creating an object of Dog and Philosopher with interface reference, testing their polymorphic ability with invoking the methods of interface. and showing how we can use a method of child class of interface (Pontificate for the case of philosopher) using casting. i will include the templates below which you will use to answer the question. you will just need to input the missing codes in the required spaces. //******************************************************************** // SpeakerTest.java Author: Lewis/Loftus // // Solution to Programming Project 10.3…