/ Is my code correct? //please make it more efficient as you can. Thank you //please correct it if there is some mistakes
Q: Define a class named Doctor whose objects are records for a clinic’s doctors. Derive this class from…
A: CODE:-
Q: Make class Student, you need to add the normal constructor with parameters not default JAVA
A: Program Description: Make class Student, you need to add the normal constructor with parameters not…
Q: Convert the Tic-Tac-Toe game into a class. Overload the < operator to print the boar Write a test…
A: #include<iostream> class ScoreList{private://Structure representing a node in the linked…
Q: Using JAVA language complete the following tasks inside the Employee class: Consider a base class…
A: Program: import java.awt.*;import java.awt.event.*;import javax.swing.*;import…
Q: Write a java program that declares two classes. The parent class is called Simple that has two data…
A: code: public class JavaExample{ int add(int num1, int num2) { return num1+num2; }…
Q: use the following partial class definitions: public class A1 { public int x; private int y; public…
A: subclass (child) - the class that inherits from another class superclass (parent) - the class being…
Q: Data Structure Add three methods to the following class
A: The static method add() takes two polynomials p1 and p2 as parameter. It finds the max matching…
Q: 1. Write the definition of a class that has the following properties: a. The name of the class is…
A: We need to create a Employee class which have 5 data members as emp name, department number, salary,…
Q: n this lab, you will construct a class called QuadraticSolver that will compute the real roots of a…
A: Answer
Q: class Al void methodA(){ } void methodB(); } class B extends A{ void methodA(){ } } O class A should…
A: 1. The correct option is- everything is okay Explanation: The given code is: abstract class A{ {}…
Q: te { private int day; // from 1 to 31 private int month; // from 1 to 12 private int year; //…
A: PROGRAM CODING: class illegilDite313Exception extends Exception { public…
Q: The following class declaration has errors. Locate as many as you can. class Circle {private:double…
A: The following class declaration has errors. Locate as many as you can. class Circle {private:double…
Q: Create a class BeautyProduct with name, color, brand. Provide Constructors, getters, setters and…
A: The question asks about constructing a super class of BeautyProduct and then two child classes for…
Q: 6. A class should take any number as an argument but no other data types. Which code does this? а.…
A: Explanation is given below:
Q: It is possible for a class to have more than one constructor. A) This is correct. B) The answer is…
A: Task :- Choose the correct option for given statement about constructors.
Q: Create a class Fractions with these capabilities: a) Create a constructor that prevents a 0…
A: The code for the given question is provided below:
Q: Consider the following code: public class DemoClass{ private double PI = 3.1416; void…
A: class DemoClass{ final private double PI = 3.1416; // Use final such that PI can not be modified…
Q: Write a class HouseBuilder with private class members as houseArea(double, e.g. 20 square feet),…
A: abstract class HouseBuilder{ protected double houseArea; protected String houseLocation;…
Q: The following class declaration has errors. Locate as many as you can. class Point {private: int…
A:
Q: A decimal number is composed of an integral part and a fractional part. The number appearing before…
A: SOLUTION: CODE: #ifndef ROUNDOFF_H #define ROUNDOFF_H #include<iostream>…
Q: plven the following code ublic class Account { private double balance; / instance variable that…
A: This is a simple Java code which makes use of Class and function to demonstrate encapsulation. In…
Q: 1.Write its default constructor 2.Write a code to declare an object from this class using the…
A: public class Main{ public static void main(String[] args) { Dog dog1=new Dog(); //create…
Q: Fill-in-the-Blank Normally a class’s _______________________________ are declared to be private and…
A: The answer is : member variables member functions.
Q: efine a class Human with properties "first name" and "last name". Define the class Student…
A: in this problem, we have to define different classes According to the conditions of the given…
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: Question :- Add a statement to the classA to test whether myChar is accessible. public class ClassB…
A: A variable is unaccessible outside a class if it is declared as private. I.e a variable that is…
Q: lo obtain the object from the this we can use the derefencing operator for example *this To obtain…
A: To understand the ‘this’ indicator, it is important to know how things look at activities and class…
Q: Complete the thick.h, thick.cpp, thin.h, and thin.cpp classes in the attached pizza solution. Modify…
A: C++ is a compiled language that follows the concept of oops to make projects. It is used to build…
Q: use the following partial class definitions: public class A1 { public int x; private int y; public…
A: instance y of class A1 is private. and A derived class doesn't inherit access to private data…
Q: The following class maintains an account balance and returns a special error code. public class…
A:
Q: Java Questions - (Has 2 Parts). Based on each code, which answer out of the choices "A,B,C,D,E" is…
A: The correct option is (a) is-a Explanation: An Is-A relationship in Java is based on inheritance.…
Q: 1. Create an Employee class and do the following: a) Declare the following member variables:…
A: The output of the main class:
Q: a class Rational for performing arithmetic with fractions. Write a driver program to test the class.…
A: NOTE: - Since the programming language is not mentioned, it is implemented in c++. PROGRAM…
Q: 8. The first few lines of the Batter class are shown below. public class Batter private String name;…
A: Find the method definition below.
Q: Pet Whisperer Define a public class Whisperer that provides a single class method named…
A: Java Code for Above : //class in which method is defined class Whisperer{ //method…
Q: A1. Find the output of the following code in order. public class Faculty extends Employee ( public…
A: Given: public class Faculty extends Employee{ public static void main(String[] args) {…
Q: A single class can have many instances of that class it’s true or false
A: The answer is...
Q: Q1.) Write a Review class that has: • These private data members: • string user: ID of the user…
A:
Q: The following is someone’s definition for the Checking class. public class Checking {…
A: Below i have highlighted the logical errors in BOLD and commented the wrong statement. Correct…
Q: Write a function that overwrite the greater than method for a class. The class has a field variable…
A: Given, The function to be implemented should overwrite greater than,and it has to implement less…
Q: using java write a program Consider the following class definition that represents an AM radio:…
A: a)Answer Pointers: All answers to question B4 square measure given in C++, however Java and…
Q: 7- Every class member is __________ by default. (public, private, not public nor private) 8- Create…
A: According to the question below the solution As per our guidelines we are supposed to answer?️ only…
Q: what problem in this java code cant find the main, can you check code package EmployeePersonal;…
A: package EmployeePersonal; //create a Driver class public class Driver { //Define main() method…
Q: Rational numbers are used to represent fractions. Arithmetic operations can also be performed on…
A: Sample Response: //java program, tested on NetBeans IDE 12.0package rational;import…
Q: public class Animal{ public Animal() { System.out.println("ANIMAL"); } } public class Horse extends…
A: super(): So super is used to call the parent class constructor so if any class inherit to any other…
Q: A1. Find the output of the following code in order. public class Faculty extends Employee ( E public…
A: One can use any one of the java compilers such as eclipse, Netbeans, or JDK in order to execute the…
Q: same function which prints "Rectangle is a polygon" and "Triangle is a polygon" respectively. Again,…
A: Given : Same function which prints "Rectangle is a polygon" and "Triangle is a polygon"…
Q: use the following partial class definitions: public class A1 { public int x; private int y; public…
A: Given that, Which of the following lists of instance data are accessible in class A2?a) x, y, z, a,…
Q: Complete the following program by writing the code at the in of "i" and "j" instance variables.…
A: class A1 { public static void main(String args[]) { Superclass sp= new Superclass() cout…
Q: Consider the following class: 1.Write its default constructor 2.Write a code to declare an object…
A: 1. Default constructor A default constructor is an empty constructor. Here, the class name is Dog.…
// Is my code correct?
//please make it more efficient as you can. Thank you
//please correct it if there is some mistakes
public class PartTimeEmployee extends Person
{
//private variables
private double payRate;
private double hoursWorked;
public PartTimeEmployee()
{
super();
/*invokes the default constructor of class Person
*/
payRate = 0;
hoursWorked = 0;
}
public PartTimeEmployee(String idPerson, String nameFirst, String nameLast,
String date, String addressPerson, double pay, double hours)
{
super(idPerson, nameFirst, nameLast, date, addressPerson);
/*invokes the non-default constructor
in other words, override the parameters from Person() non-defaukt
with another set of parameters, example 'idPerson' variable
overrides 'id' in Person()
*/
this.payRate = pay;
this.hoursWorked = hours;
}
public String toString(String idPerson, String nameFirst, String nameLast,
String date, String addressPerson)
{
return idPerson+nameFirst+nameLast+date+addressPerson;
//not sure about this one, please check
}
public double getPayRate(){return payRate;}
public double getHoursWorked(){return hoursWorked;}
public void setNameRateHours(String idPerson, String nameFirst, String nameLast,
String date, String addressPerson, double pay, double hours)
{
super.setPerson(idPerson, nameFirst, nameLast, date, addressPerson);
this.payRate = pay;
this.hoursWorked = hours;
//not sure about this, please check
}
public double calculatePay(){return (payRate*hoursWorked);}
//this one , calculatePay, not sure if this is the correct formula xD
Step by step
Solved in 2 steps with 5 images
- def new_line(): print('.') def three_lines(): new_line() new_line() new_line() def nine_lines(): three_lines() three_lines() three_lines() def clearScreen(): print('Printing nine lines') nine_lines() print('Printing nine lines') nine_lines() print('Printing three lines') three_lines() print('Printing three lines') three_lines() print('Printing new line') new_line() print('Line from main function')print('Calling clearScreen function') clearScreen() Assessment The following items will be used in the grading rubric for this assignment. Make sure that you have addressed each item in your assignment. Does the assignment implement new_line, three_lines, nine_lines, and clear_screen functions, as well as a main section of the program which calls the functions? Does the assignment demonstrate the use of nested function calls? Does the assignment produce the appropriate output when executed? The output should be recorded in a text file, a…Flight assignment runs but there is no imput values for the user to interact when running the program. Kindly fix this issue.import java.util.*; class Flight { String airlineCode; int flightNumber; char type; // D for domestic, I for international String departureAirportCode; String departureGate; char departureDay; int departureTime; String arrivalAirportCode; String arrivalGate; char arrivalDay; int arrivalTime; char status; // S for scheduled, A for arrived, D for departed public Flight(String airlineCode, int flightNumber, char type, String departureAirportCode, String departureGate, char departureDay, int departureTime, String arrivalAirportCode, String arrivalGate, char arrivalDay, int arrivalTime) { this.airlineCode = airlineCode; this.flightNumber = flightNumber; this.type = type; this.departureAirportCode = departureAirportCode; this.departureGate = departureGate;…public class ItemToPurchase { private String itemName; private int itemPrice; private int itemQuantity; // Default constructor public ItemToPurchase() { itemName = "none"; itemPrice = 0; itemQuantity = 0; } // Mutator for itemName public void setName(String itemName) { this.itemName = itemName; } // Accessor for itemName public String getName() { return itemName; } // Mutator for itemPrice public void setPrice(int itemPrice) { this.itemPrice = itemPrice; } // Accessor for itemPrice public int getPrice() { return itemPrice; } // Mutator for itemQuantity public void setQuantity(int itemQuantity) { this.itemQuantity = itemQuantity; } // Accessor for itemQuantity public int getQuantity() { return itemQuantity; }} import java.util.Scanner; public class ShoppingCartPrinter { public static void main(String[] args) { Scanner scnr = new…
- Following programs contain syntax/logical errors. Underline the error and explain precisely the cause of the error to get any credit. Just underlining will not be given credit. [2.5x2=5] i. interface P{ void fun(int x) ; } ------------------------ class S implements P{ public void funny(){ System.out.print(“OOP is funny”); } public static void main(String args[]){ S s1 = new S(); s1.funny() } } ii. public class A{ int x; void A(int x) { this.x=x; System.out.println("in Class A"); } public static void main(String[] args){ new A(5); }Java Constructor(String) This constructor will take a string of digits(no commas) and turn it into an UnboundedInt object (MUST BE STRING INPUT) UnboundedInt add (UnboundedInt ) A method that adds the current UnboundedInt with a passed in one. The return is a new UnboundedInt. UnboundedInt multiply (UnboundedInt ) - do this one last! A method that multiplies the current UnboundedInt with a passed in one. The return is a new UnboundedInt. void addEnd ( int ) -optional method (helpful) A method to add a new element at the end of the sequence , used for building up each higher term in a single sequence. (i.e. adding a new IntNode to the linked list) UnboundedInt clone( ) a method that returns a copy of the original structure boolean equals ( Object ) a method that returns true if linked list represents the same numerical number as the input parameter. False otherwise. Overrides method in Object class. String toString ( ) creates a string of all elements…Class Quiz public Quiz (int quesList, int quesMissed) {quesList = this.quesList;quesMissed = this.quesMissed;} private void calculate(){// get the point worth of each question and calculate final scorepointsPerQues = (100/quesList);scoreQuiz = quesList - quesMissed;} Class PassFailQuiz public PassFailQuiz (int quesList, int quesMissed, int scoreQuiz) { super(quesList, quesMissed);} How do I move scoreQuiz from private void calculate() to equal the third constructor value in PassFailQuiz?
- Identify errors if there is any & after identifying rewrite the code: public class Employce { private String name; private String address; private int number; public abstract double computePay(){ System.out.println("compute the pay"); return 0.0; } public double thanks(){ System.out.println("Thanks");}} public class EmployeeCheck Extends Employee{ public double computePay(){ return number*numer;}}class Player { protected: string name; double weight; double height; public: Player(string n, double w, double h) { name = n; weight = w; height = h; } string getName() const { return name; } virtual void printStats() const = 0; }; class BasketballPlayer : public Player { private: int fieldgoals; int attempts; public: BasketballPlayer(string n, double w, double h, int fg, int a) : Player(n, w, h) { fieldgoals = fg; attempts = a; } void printStats() const { cout << name << endl; cout << "Weight: " << weight; cout << " Height: " << height << endl; cout << "FG: " << fieldgoals; cout << " attempts: " << attempts; cout << " Pct: " << (double) fieldgoals / attempts << endl; } }; a. What does = 0 after function printStats() do? b. Would the following line in main() compile: Player p; -- why or why not? c. Could…// Declare data fields: a String named customerName, // an int named numItems, and // a double named totalCost.// Your code here... // Implement the default contructor.// Set the value of customerName to "no name"// and use zero for the other data fields.// Your code here... // Implement the overloaded constructor that// passes new values to all data fields.// Your code here... // Implement method getTotalCost to return the totalCost.// Your code here... // Implement method buyItem.//// Adds itemCost to the total cost and increments// (adds 1 to) the number of items in the cart.//// Parameter: a double itemCost indicating the cost of the item.public void buyItem(double itemCost){// Your code here... }// Implement method applyCoupon.//// Apply a coupon to the total cost of the cart.// - Normal coupon: the unit discount is subtracted ONCE// from the total cost.// - Bonus coupon: the unit discount is subtracted TWICE// from the total cost.// - HOWEVER, a bonus coupon only applies if the…
- Computer Science You are required to develop a small chatting application where two or more friends can communicate each other through messages. Create a class Message which has Date d, and message (string). Provide getters/setters, constructors, toString. Create a class Friend having String name, String contact, email and ArrayList of Messages provide getters/setters, constructors, toString addMessage(Message m) method which will add new message to the list. Provide following options to the user using JFrame. Login which will help user login to the application. View Friends (Display List of All Friends) View Messages ( This should display all message of a Friend) Send message (This should ask for friend name and message match the friend name and write that message to the array list).I have problem in java 2 code: lease.setApartmentNumber(sc.nextLine()); melt:String cannot be converted to int and lease.setMonthlyRent(sc.nextLine()); melt introduce variable and lease.setPeriod(sc.nextLine()); melt: introduce variable System.out.println("Tenant's Name"+lease.getTenantName()+"\nApartment Number:"+lease.getApartmentNumber()+"\nMonthly Rent:"+NumberFormat.getCurrencyInstance().format(lease.getMonthlyRent())+"\nTerm of lease in month;"+lease.getPeriod());} melt: create Object getMonthlyRent() Java 1: package lease; public class Lease { private String tenantName;private int apartmentNumber;private double monthlyRent;private int Period; public Lease() {apartmentNumber = 0;int monthlyRent = 10000;int Period = 12; } // Getter Methodpublic String getTenantName() {return tenantName;} public void setTenantName(String tenantName) { this.tenantName = tenantName;} public int getApartmentNumber() {return apartmentNumber;} public void setApartmentNumber(int…Load your bag with some initial values, but do not fill it. Your client code should give the user the option to: display the contents of the bag using the class method “toVector” add values to the bag remove values from the bag sort the bag search for a value using their choice of either the iterative search or the recursive search - both need to be tested Allow the user to keep doing these things until they are done. Do not automatically sort the bag if the user chooses to search. Your program should give the user a message telling them they must first sort the bag before they can search.You decide what the user interface will be. Make it clear and easy to use. It can be very basic; nothing fancy. A menu driven program works well. Each value in your array should be unique - no value will appear in the array multiple times. Your array elements can be any data type – use a template class put in place in the code provided. You can write your client code to process a bag holding any…