Please give the code without errors

HELLO!!
EXPLANATION:
CODE:
import java.util.Scanner; //importing Scanner class
class Person //super class
{
String name; //declaring variables
Person(String s){ //constructor to assign values to the variables
name=s;
}
}
class Doctor extends Person //sub class
{
String specialty; //attributes
double fee;
Doctor(String s1,String sp,double f) //constructor assing values to the attributes
{
super(s1); //calling the super class constructor and passing a string parameter
specialty=sp;
fee=f;
}
void setFee(double f1) //a setter method
{
fee=f1;
}
double getFee() //a getter method
{
return fee;
}
public String toString(){ //to string method
return (name+" "+specialty+" "+fee);
}
}
class DoctorTest //class with main method
{
public static void main(String args[]){
Scanner sc=new Scanner(System.in); //instance to scanner class
System.out.println("Enter the doctors name: ");
String n1=sc.next(); //promts the user to enter
System.out.println("Enter the doctor's specialty: ");
String n2=sc.next(); //promts the user to enter
System.out.println("Enter office visit fee: ");
double f1=sc.nextDouble(); //promts the user to enter
Doctor d=new Doctor(n1,n2,f1); //object creation
System.out.println(d.toString()); //prints the return of tostring method
d.setFee(f1); //calling setFee method
System.out.println("Doctor's fee is: "+(d.getFee()));//printing the return of getFee method
}
}
OUTPUT:

Please give the code without errors Define a class named Doctor whose objects are records for...
Define a class named Payment that contains an instance variable "paymentAmount" (non-static member variable) of type double that stores the amount of the payment and appropriate accessor (getPaymentAmount() ) and mutator methods. Also create a method named paymentDetails that outputs an English sentence to describe the amount of the payment. Override toString() method to call the paymentDetails() method to print the contents of payment amount and any other details not included in paymentDetails(). Define a class named CashPayment that is...
Code the following Program in C++ Define a class named Payment that contains a member variable of type float that stores the amount of the payment and appropriate accessor and mutator methods. Also create a member function named paymentDetails that outputs an English sentence that describes the amount of the payment. Next define a class named CashPayment that is derived from Payment. This class should redefine the paymentDetails function to indicate that the payment is in cash. Include appropriate constructor(s)....
C++ Assignment: Create a class called FitnessMember that has only one variable, called name. The FitnessMember class should have a constructor with no parameters, a constructor with a parameter, a mutator function and an accessor function. Also, include a function to display the name. Define a class called Athlete which is derived from FitnessMember. An Athlete record has the Athlete's name (defined in the FitnessMember class), ID number of type String and integer number of training days. Define a class...
java This lab is intended to give you practice creating a class with a constructor method, accessor methods, mutator methods, equals method , toString method and a equals method. In this lab you need to create two separate classes, one Student class and other Lab10 class. You need to define your instance variables, accessor methods, mutator methods, constructor, toString method and equals method in Student class. You need to create objects in Lab10 class which will have your main method...
IN JAVA For the following questions, “define a class” means the following: • Create an appropriately-named file containing the Java class definition, including the following: – A block comment describing the file (and hence the class), as always – Any instance variables, as required by the question – Accessor (getter) and mutator (setter) methods for any instance variables – Constructors as appropriate or as required by the question – A toString method that prints instances of the class informatively –...
Programming Assignment 1 Write a class called Clock. Your class should have 3 instance variables, one for the hour, one for the minute and one for the second. Your class should have the following methods: A default constructor that takes no parameters (make sure this constructor assigns values to the instance variables) A constructor that takes 3 parameters, one for each instance variable A mutator method called setHour which takes a single integer parameter. This method sets the value of...
TASK 1 Create a new class called CheckingAccount that extends BankAccount. It should contain a static constant FEE that represents the cost of clearing onecheck. Set it equal to 15 cents. Write a constructor that takes a name and an initial amount as parameters. Itshould call the constructor for the superclass. It should initializeaccountNumber to be the current value in accountNumber concatenatedwith -10 (All checking accounts at this bank are identified by the extension -10). There can be only one...
In Java please!
Problem You will be using the point class discussed in class to create a Rectangle class. You also need to have a driver class that tests your rectangle. Requirements You must implement the 3 classes in the class diagram below and use the same naming and data types. Following is a description of what each method does. Point Rectangle RectangleDriver - x: int - top Left: Point + main(args: String[) - y: int - width: int +...
This is a C++ program Instructions Design a class named PersonData with the following member variables declared as strings: lastName firstName address city state zip phone Create 3 constructors; a default constructor, a constructor that accepts the first and last name member variables, and a constructor that accepts all member variables. Write the appropriate accessor/getter and mutator/setter functions for these member variables. Create a method within this class called getFullName() that returns the person's first and last names as a...
I have Majority of the code written but I just need to implement
the <,>,and = sign in the code. I have posted the
instructions for the whole code. I will add what I have at the
end.
Objectives:
Implement basic class concepts in Java
Implement inheritance with super and sub-classes
Implement basic polymorphism concepts
Problem: The TARDIS has been infected by a virus which means it
is up to Doctor Who to manually enter calculations into the TARDIS
interface....