Write a Java enumeration LetterGrade that represents letter grades A through F, including plus and minus grades. Define a private instance vari- able to hold a boolean value that is true if the grade is passing. Also, define a constructor that initializes this instance variable, an accessor method is- Passing to return its value, and a method toString that returns the grade as a string. Finally, write a program to demonstrate the enumeration.
Q: Suppose the class SportsCar is a derived class of a class Automobile,and suppose also that the class…
A: PARENT CLASS: Automobile Methods: accelerate, addGas DERIVED CLASS: SportsCar
Q: Implement a new class that implements Comparatorof GregorianCalendar class to be able sort the…
A: The String[] having date as a string for 10 dates is created and initialized. Method private static…
Q: Extend the Rectangle class by adding and implementing the special operator methods for the six…
A: class Rectangle:def __init__(self, x, y, width, height):self.x = xself.y = yself.width =…
Q: Derive a class BuyNItemsGetOneFree from DiscountPolicy, as described in Exercise 10. The class…
A: public class BuyNItemsGetOneFree extends DiscountPolicy{ private int numberOfItems;…
Q: Write a java program : Create an abstract class ‘Fares’ with an abstract method ‘fareCharged()’.…
A: An abstract class in java is a class that cannot be instantiated which means no instances of any…
Q: Implement a superclass Person. Make two classes, Student and Instructor, that inherit from Person. A…
A: Java is a programming language originally developed by James Gosling at Sun Microsystems (which is…
Q: Write a Java program that define class Rectangle with two instance variables length and width of…
A: Task : Define the Rectangle class. Define the get and set methods.
Q: Write the Boat class in Java Eclipse. A Boat has a registered name, a number of cabins, and a…
A: I give the code in Java eclipse as per your requirement along with code and output screenshot
Q: We have a parking office class for an object-oriented parking management system using java Add…
A: Ans:) Here we need to implement the getCustomerIds method in ParkingOffice class. The parkingOffice…
Q: Write a complete Java class that can be used to create a Hamster object as described below: A…
A: The solution for the above given question is given below:
Q: Using the concept of classes in object-oriented programming Write java Project For Alahli school…
A: I am assuming that marks in subjects are out of 100. You can run the code on online gdb compiler.
Q: Help me out with this java problem. Given partial codes of the Colored interface and Point…
A: ANSWER:-
Q: Design a Java class named LinearEquation for a 2-by-2 system of linear equations: ax + by = e…
A: the code is given below: given: The class contains:• Private double data fields a, b, c, d, e, and…
Q: Write a program in java Write a class Car that contains the followings attributes: The name of…
A: JAVA CODE is given Below:
Q: Write a complete program for the description given below. Consider a Billing class that implements…
A: Note: Since you have not provided the language to write the code so I am using Java language to…
Q: We have a parking office class for an object-oriented parking management system using java Add…
A: The above mentioned question demands a database that will keep record of the vehicles parked in the…
Q: We have a parking office class for an object-oriented parking management system using java Add…
A: Below is the code with explanation:
Q: In this problem, we are going to use ArrayLists and classes to design a road trip. You have three…
A: Actually, Java is a programming language originally developed by James Gosling at Sun Microsystems…
Q: write the definition of a class ContestResult containing: an instance variable winner of type…
A: The class ContestResult will have three instance variables winner, second_place, third_place and…
Q: write program in java Design an abstract class GeometricObject. GeometricObject must ensure that…
A: The RectangleYourRegNo class is shown below. public static class RectangleYourRegNo extends…
Q: Below we have class diagrams with three classes for a simple java based parking management class.…
A: Solution - For a parking management system, use the Observer pattern to implement this interaction…
Q: Implement a Python class for the Tweet ADT with an instance variable for storing the text and a…
A: Python program to solve the given problem.
Q: Implement a class Moth that models a moth flying along a straight line. The moth has a position,…
A: public class Moth{ private double position; public Moth(double initialPosition) {…
Q: Create an interface MessageDecoder that has a single abstract method decode(cipherText), where…
A: File name: “MessageDecoder.java” //create an interface public interface MessageDecoder {…
Q: Write a class named NameAndCount for recording a String data name and an int data named count. A…
A: The NameAndCount class implements a Comparable interface. An interface is a class that contains the…
Q: Implement using Java Create an interface that shall have 2 methods and one string type attribute,…
A: I have added the comments in the code. Also, make sure to give the java file name Demo.java. If you…
Q: Implement all the classes using Java programming language from the given UML Class diagram. Note:…
A: Ans:) As per the answering guidelines, we can only solve the first questions. Please post the…
Q: Suppose we want to implement a drawing program that creates various shapes using keyboard…
A: Given: Abstract base class DrawableShape that knows the center (two integer values) and the color (a…
Q: Write one java program with a class whose instances represent a single playing card from a deck of…
A: Question states you need to write a java class whose instance represent a single playing card from…
Q: For a parking management system, use the Observer pattern to implement this interaction using Java…
A: For a parking management system, use the Observer pattern to implement this interaction using Java…
Q: Hand-write a complete Java class that can be usedto create a Car object as described below.a. A…
A: Handwritten code is shown below -
Q: Write a Java program that defines a Shape class having an abstract method draw(). Inherit Rectangle,…
A: Java program that defines a Shape class having an abstract method draw(): import java.util.* ;…
Q: Create a Java Project (with a class and a test class) to represent some real-world entity such as a…
A: The complete answer in Java Programming Language is below: we are taking example of person.
Q: Complete the class LeprechaunGold to model a stash of gold coins at the end of the rainbow. There is…
A: PROGRAM: LeprechaunGold.java: //Defining the class public class LeprechaunGold { //Declaring…
Q: Imagine you have two classes: Employee (which represents being an employee) and Ninja (which…
A: Given: Imagine you have two classes: Employee (which represents being an employee) and Ninja (which…
Q: Write a java program Write a class named Employee with name and salary as private data fields. Add…
A: The main objective of the program is to create three java files. Employee.java Manager.java…
Q: Write a Java class Book with following features: O Instance variables: o firstName for the author's…
A: PROGRAM EXPLANATION Create a class Author as given in the question. Declare two instance variables…
Q: Import Class a) Implement a class Rectangle with two attributes, width and height. b) Implement an…
A: Note: Answering the first three subparts as per the guidelines. Task : Define class name Rectangle…
Q: Add(implement) a method to the Parking Office class to return the collection of permit ids for a…
A: public List<String> getPermitIds(Customer c){ List<String> permitid = new…
Q: Using JAVA Language Consider a Billing class that implements an interface Payable having a method…
A: Solution: //java Program: //Doctor.java //class Doctorpublic class Doctor { // Declaring Instance…
Q: Implement the class Employee as presented by the following UML diagram: Employee id:int…
A: Step 1 : Start Step 2 : Define a class Employee , and Declare it's members as id , firstname ,…
Q: Consider the following instance variables and method from a class: private String descriptor; public…
A: Given descriptor is "regular" Called makeSentence(3, false) Thus, quant=3, sign=false
Q: Write a class named NameAndCount for recording a String data name and an int data named count. A…
A: The interface is a class that contains the declarations of the methods and the definition of the…
Q: Define a constructor in class Child and give an appropriate initial values for the instance (name,…
A: The answer is goven below:-
Q: Write a java program Create an Abstract class Student that contains a method take exam, implement…
A: Create an Abstract class Student that contains a method take exam, implement the method in the child…
Q: Write the implementation of the Java classes based on the following UML diagram. (a) Define the…
A: A UML diagram contains the attributes and methods of a class. It defines the types of attributes,…
Q: Write a Java program that defines a Shape class having an abstract method draw(). Inherit Rectangle,…
A: Code: import java.io.*; import java.util.*; //Abstract Shape class having an abstract method…
Q: we have a hierarchal relationship between : Fruit , Mango , Apple , and Orange . Assume that you see…
A: It is defined as a data model in which the data are organized into a tree-like structure. The data…
Q: Implement a supe lass Person. Маке two classes, Student and Instructor, that inherit from Person. A…
A: // Screenshot of the code & output
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
- Write a class that implements Employee class that is described in UML diagram given below. The method “ raiseSalary(percent) " increases the salary by the given percentage. Write a test program that will generate at least 3 accounts and test each method that you write. Employee -id:int -firstName:String -lastName:String -salary:int +Employee(id:int, firstName:String, lastName:String, salary:int) +getID():int +getFirstName():String +getLastName():String +getName():String +getSalary():int +setSalary(salary:int):void +getAnnualSalary():int • +raiseSalary(int percent):int +tostring():String. "firstName Llastname" salary * 12 Increase the salary by the percent and return the new salary "Employee[id=?,name=firstName lastname,salary=?]"Write a class with a constructor that accepts a String object as its argument. The class should have a method that returns the number of b, c, d, f, g, h, and z in the string. Demonstrate the class in a program that asks the user to enter a string and returns the number of b, c, d, f, g, h, and z in the user string.Define a class in java representing physical elements (like hydrogen, helium, lithium,etc.). Elements have a name, a symbol, an integer atomic number, and an atomicweight (which may be fractional). Your class should have a constructor that setsall the properties, and a toString method that prints each element as a nicelyformatted String. Write accessors and mutators for each field if you think it isappropriate to do so (ask yourself if the field should be changeable). Update yourmain method to create and print 10 unique elements.
- using python language Suppose a call center has three levels of employees—respondent, manager, and director. An incoming telephone call must first be allocated to a respondent who is free. If the respondent cannot handle the call, the call must be escalated to a manager. If the manager is occupied, then the call should be escalated to a director. Design your own classes and data structures for this problem. Implement a method dispatchCall() that assigns a call to the first available employee.For the Employee class, create the following: A private String instance variable m name. A private string instance variable m department. A constructor that takes two parameters (in the order of name, department) and sets the instance variables. A getter method for m name and a getter method for m department. An abstract string method named getPaycheck that does not take any parameter.write a java program This composition example contains classes Date, Employee and EmployeeTest .Class Date declares instance variables month, day and year to represent a date. The constructor receives three int parameters. It has checks to validate the month—if the value is out-of-range the method throws an error message, same goes for day. Provide getters, setters and toString method. Class Employee has instance variables firstName, lastName, birthDate and hireDate. firstName and lastName are references to String objects. Members birthDate and hireDate are references to Date objects. • The Employee constructor takes four parameters—first, last, dateOfBirth and dateOfHire. Initialize the hireDate and birthDate with these objects by calling its constructor and setters. • When class Employee’s toString method is called, it returns a String containing the employee’s name and the String representations of the two Date objects. Each of these Strings is obtained with an implicit call…
- Write a program in java Design a class that holds the following personal data: name, address, age, and phone number.Write appropriate accessor and mutator methods. Demonstrate the class by writing aprogram that creates three instances of it. One instance should hold your information, andthe other two should hold your friends’ or family members’ information.Programing language is Java. Define a class Person that represents a person. People have a name, an age, anda phone number. Since people always have a name and an age, your class shouldhave a constructor that has those as parameters. Define a toString() method whichdisplays all of the relevant information using a format like this: “Jim Lahey - Age 57- Phone 9025555555”.Write Java code for a Baby class. A Baby has a name of type String and an ageof type integer.Supply two constructors: one will be the default constructor, that just setsdefault values for the name and age; the second constructor will take twoparameters, a string to set the name and an integer to set the age. Also, supplymethods for setting the name, setting the age, getting the name and getting theage.The class should not contain I/O methods; input of values to the instancevariables must be done with a set method or constructor, output of values fromthe instance variables must be done with get methods. The set method for thename instance variable should ensure that the input is not empty or containwhitespaces (otherwise set a default value). The set method for the ageinstance variable should validate the input to be between 1 and 4 inclusive(otherwise set a default value).Give Java code for an equals method for the Baby class. Babies count asbeing the same (i.e. equal) if their names…
- Suppose a call center has three levels of employees: respondent, manager, and director. An incoming telephone call must first be allocated to a respondent who is free. If the respondent cannot handle the call, the call must be escalated to a manager. If the manager is occupied, then the call should be escalated to a director. Design YOUR OWN classes and data structures for this problem. Implement a method dispatchCall() that assigns a call to the first available employee.1/ Implement a class Employee. An employee has a name (a string) and a salary (a double). Provide a constructor with two arguments public Employee(String employeeName, double currentSalary) and methods public String getName() public double getSalary() public void raiseSalary(double byPercent) These methods return the name and salary, and raise the employee's salary by a certain percentage. Sample usage: Employee harry = new Employee("Hacker, Harry", 50000); harry.raiseSalary(10); // Harry gets a 10 percent raise Supply an EmployeeTester class that tests all methods. 2/Implement a class Car with the following properties. A car has a certain fuel efficiency (measured in miles/gallon or liters/km—pick one) and a certain amount of fuel in the gas tank. The efficiency is specified in the constructor, and the initial fuel level is 0. Supply a method drive that simulates driving the car for a certain distance, reducing the amount of gasoline in the fuel tank. Also supply methods…Write a java programImagine a publishing company that markets both book and audiocassette versions of its work. Create a class publication that stores the title (a string) and price(type float) of a publication. From this class derive 2 classes: book, which adds a page count (type int); and tape, which adds a playing time in minutes (type float). Each of theses 3 classes should have a getdata() method to get its data from the user at the keyboard, and a putdata() function to display its data. Suppose you want to add the date of publication for both books and tapes. From the publication class, derive a new class called publication2 that includes this data member. Then change book and tape so ther are derived from publication2 instead of publication. Make all the necessary changes in member functions so the user can input and output dates along with the other data. For the dates, you can use the bulit-in date function which stores a date as 3 ints, for months, day and year. Write a…