Book class: • private data members: o bookName: as String o bookAuthor: as object of class Author o publishYear: as int; the year must be >=1; otherwise the default value is 1990 public operations: o parameterized constructor that accepts values for all the class attributes o setters/ getters for each attribute o getBook: that returns a String contains data members values in the following format: bookName by authorName from authorCountry, Publish Year: publishYear (example: Java by Ahmad from Palestine, Publish Year: 2000)
Q: 1. The Java class called Holiday is started below. An object of class Holiday represents a…
A: Given: 1. The Java class called Holiday is started below. An object of class Holiday…
Q: Fill in the CODE (Answer) or the bolded Answer word. A class BankAccount with the following data…
A: String name, String acctNum, and double balance are data members of the BankAccount type. It…
Q: public class Compute { public static int method1 (int var) { // increment var by 1 return (var + 1);…
A: Given: We need to write the method invocation sequence.
Q: (Java) public class Person{ private String name; ... What terms describe 'name' in the…
A: .attribute.instance variable.field.data member
Q: Write the exact output that you expect to see on the screen when the indicated statements are…
A: Answer the above program are as follows:
Q: Suppose you have defined a class such as the following for use in a program:public class…
A: Suppose you have defined a class such as the following for use in a program:public class…
Q: JAVA Consider the following class : public class Store { Public final double…
A: File name: "Store.java" public class Store { public final double SALES_TAX_RATE = 0.06;…
Q: COMPILER ERROR MESSAGES Driver.java:4: error: class TriangleDriver is public, should be declared in…
A: - We need to highlight and correct the problem described in the picture above.
Q: (Java) 7.1 Code: Look at the following Person.java class code: class Person{ public String name;…
A: We need to add getter and setter methods in Person.java class and need to rectify some errors.…
Q: hispe Define a public class Whisperer that provides a single class method named vhisper.whisper…
A: Note: Since you have not provided the language to write the code so I am using java language to…
Q: Java Problem. compile and run the code below: /** A class to test the Door class. */ public…
A: Class definition: A class is a user-defined data type that contains the data members and methods.…
Q: Write a SavingsAccount class for this Java program.
A: Find the following code
Q: The Java class called Holiday is started below. An object of class Holiday represents a holiday…
A: public class Holiday { private String name; private int day; private String month; }
Q: public class Main 2- public static void main(String args[]) 3 static_out obji - new static_out();…
A: Classes and objects in java: Java is an object-oriented programming language and makes use of…
Q: Java programming language I need the two classes ( the testing class and the class with the…
A: We can merge both the classes in one (testing and method class) . We can use main method the…
Q: 4. Consider the following classes: public class Animal { public Animal (String itsNane) { name…
A: Answering first three subparts as per the guidelines. The problem is based on the basics of…
Q: AVA Class and Object WRITE THE OUTPUTS OF THE FOLLOWING!!! A.) public class MyClass {…
A: A.) Output: Hello World! Explanation: The given code call the method myMethod() that has a…
Q: blic class myClass { private int n; public String s; public static double d; public void myFun () {…
A: Lets see the solution.
Q: write down the correct/missing code.Elaborate if needed by writing a comment with a blue font color.…
A: I give the correct code for both parts along with output and code screenshot
Q: Python Programming- Invoice Class Introduction: Requires creating classes and instantiating…
A: Algorithm: Start the program. Create a class “Invoice”, Initialize the necessary variables. Define…
Q: public class Appliance { public int getVoltage() { return 10; } Appliance.java public interface…
A:
Q: Use Java Programming Language Please Provide a Code that works Properly Loan Account Class:…
A: The asked code for the Java program has been provided in the next step.
Q: What number spent the longest time on the phone? Return the correct number as a string. public…
A: Below i have answered:
Q: Modify the FrultBasket class as follows: - Fruit baskets should have one attribute basket: an array…
A: public class Fruit { //attributes protected String name = null; protected String colour = null;…
Q: public class Client { public static void main(String [] args){ Color v = new Red(); v.doColor(); } }…
A: Please find the answer below:
Q: b. public class Client { public static void main (String [] args){ Color v = new Red (); v.doColor…
A: The method overriding is defined as the process in which a class and a derived class consist of the…
Q: JAVA PROGRAM Define a class called Circle a Circle object stores a radius and the (x,y) coordinates…
A: Required: JAVA PROGRAM Define a class called Circle, a Circle object stores a radius and the (x,y)…
Q: 1 using System; 2 public class Person { public Person(string firstName, string lastName) { FirstName…
A: Here have to determine about code add for getage.
Q: Create a checking account class with three attributes: account number, owner’s name, and balance.…
A: import java.util.Scanner; public class CheckingAccountDemo { public static void main(String[] args)…
Q: Complete and answer the java problem below Define a java interface named BookInterface with the…
A: Algorithm: Start Create an interface BookInterface with given methods Create a class named Book…
Q: B1. Answer the following questions: a. Given: class A { class Cextends B { public String toString()…
A: Please find the program and output in the below steps.
Q: public class Main { public static void main(String args[]) { Main m = new Main();…
A: Here is the step by step instructions Make sure that all the files are in the same folder and…
Q: What is the output? public static void main(String[] args) { new ChildClass(); }…
A: The program is a single inheritance in which one derived class that is child class obtains the…
Q: public class Main5 { public static void main(String[] args) { int a = 5; int b = 6, float c = a/b,…
A: You Can Use Type Casting .since a ,b is int type and c is float so you explicit tell the compiler…
Q: Create class Author with following instance variable and methods. Instance variables: name (String),…
A: Author.java //create class Authorclass Author { //instance variables private String name;…
Q: PLease help me add four Java OOP concepts iin the program. Add comment so I can identify what…
A: I give the code with the addition of all oops concept I also highlighted as well as comment the…
Q: Support computing sales tax in the CashRegister class. The tax rate should be supplied when…
A: Note: you have not provided CashRegisterTester.java class file. so, we cannot provide compiled code…
Q: Solve this error using System; namespace RahmanA3P1BasePlusCEmployee { public class…
A: using System; namespace RahmanA3P1BasePlusCEmployee{ public class BasePlusCommissionEmployee…
Q: tumLeft and turn Right methods that change the direction of the robot but not the location move…
A: public class Robot{ //declaring instance variables private String name; private int xPos; private…
Q: Write the definition of a classTelephone. The class has no constructors and one static method…
A: In this java code we have to define the class Telephone where it will have one static method and…
Q: public class Person { // PLEASE START YOUR CODE HERE //…
A: Java. Code: public class Person{// PLEASE START YOUR CODE HERE//…
Q: Complete and answer the java problem below Define a java interface named BookInterface with the…
A: interface BookInterface { public String getPublisher(); public void setPublisher(String…
Q: Bank Account Details
A: Java Code for class Account: //Super class accountpublic class Account{//all the variables with it's…
Q: Write a program in java. The Java class called Holiday is started below. An object of class…
A: public class Holiday { //declaring variables private String name; private int day; private String…
Q: 3. Using the given code answer the given questions in the box. Public class MyClass Accessor: {…
A: An Accessor method is known as a get method or a getter. A Mutator method is known as a set method…
Q: In Java: Define a class called Exam that manages a set of up to 25 Question objects. Define the add…
A: class Exam { add( ) method { // Add question to the exam// } assignExam( ) method { //Assigns…
Q: Consider the following classes: public class Animal { public Animal(String itsName) { name…
A: NOTE : Answering only first 3 subparts as per the guidelines. We will write code in the compiler.…
Q: 4. Consider the following classes: public class Animal { public Animal(String itsName) { name public…
A: Polymorphism means having various forms. Thus it is the ability of something to exhibit more than…
Q: A class called Author (as shown in the class diagram) is designed to model a book's author. It…
A: public class Author{ //declaring data members private String name; private String emailId; private…
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.…
java
i need a book class
Auther class:
public class Author {
private String authorName;
private String authorCountry;
public Author(String authorName, String authorCountry) {
this.authorName = authorName;
this.authorCountry = authorCountry;
}
public String getAuthorName() {
return authorName;
}
public void setAuthorName(String authorName) {
this.authorName = authorName;
}
public String getAuthorCountry() {
return authorCountry;
}
public void setAuthorCountry(String authorCountry) {
this.authorCountry = authorCountry;
}
public String getAuthor()
{
return (authorName+" from " + authorCountry);
}
}
Step by step
Solved in 3 steps with 2 images
- Employee Class (Medium) Write a class named Employee that has the following member variables: name. A string that holds the employee’s name. idNumber. An int variable that holds the employee’s ID number. department. A string that holds the name of the department where the employee works. position. A string that holds the employee’s job title. The class should have the following constructors: A constructor that accepts the following values as arguments and assigns them to the appropriate member variables: employee’s name, employee’s ID number, department, and position. A constructor that accepts the following values as arguments and assigns them to the appropriate member variables: employee’s name and ID number. The department and position fields should be assigned an empty string (""). A default constructor that assigns empty strings ("") to the name, department, and position member variables, and 0 to the idNumber member variable. Write appropriate mutator functions that…Create a class Employee a) private and static field nextAvailableID (int): create a static constructor to initialize this field to a random number (hint: you can use Random class). You can assume that IDs are numbers between 1-9999. Since nextAvailableID is static, all the Employee objects will share this field. b) with properties FirstName (string) LastName (string), ID (int): make it read only to allow initializing only with a constructor and then no more. c) Add a constructor to allow setting properties FirstName and LastName. Hint: ID will be initialized to nextAvailableID (make sure to increment nextAvailableID by one) Add ToString Method to display the full name and ID of the employee Then, write a Main method to test your class Employee. Create four Employee objects with references e1, e2, and e3 by providing first and last name of each employee Display the full name and id of each employee - note that each employee will have an automatically generated ID…inventory.py templete #========The beginning of the class ========== classShoe: def__init__(self,country,code,product,cost,quantity): pass ''' In this function, you must initialise the following attributes: ● country, ● code, ● product, ● cost, and ● quantity. ''' defget_cost(self): pass ''' Add the code to return the cost of the shoe in this method. '''defget_quantity(self):pass''' Add the code to return the quantity of the shoes. ''' def__str__(self): pass ''' Add a code to returns a string representation of a class. ''' #=============Shoe list==========='''The list will be used to store a list of objects of shoes.''' shoe_list=[] #==========Functions outside the class============== defread_shoes_data(): pass ''' This function will open the file inventory.txt and read the data from this file, then create a shoes object with this data and append this object into the shoes list. One line in this file represents data to create one object of shoes. You must use the try-except in this…
- TIME CLASS (C++) - Write a time class named timeClass - Write code to demonstrate that it works - The timeclass class will be named timeClass - The class must have these 3 constructors: #1) timeClass(); #2) timeClass(int h, int m, int s); #3) timeClass (string timeIn); - The string constructor must be capable of being separated by colons or blanks time in the 24-hour format: example 23:11:07 or 9:4:9 or 11 31 27 - DO NOT use some system functions for this assignment. You must write the code. - Yes, you can convert from string to integer stoi ( string). - In addition to the constructors, you should supply a set of getters (Accessors) getH, getM getS - In addition to that, add mutators that allow the individual setting of Hours, Minutes and Seconds: setH(int), setM ( int ) setS( int ) Include this setter ( Mutator) setTime( int NumSeconds); - So if I call setTime( 7673) you would know that that is: -- hours, -- minutes and -- seconds seconds = 53 7673 % 60…(Invoice Class) Create a class called Invoice that a hardware store might use to representan invoice for an item sold at the store. An Invoice should include four data members—a part number (type string), a part description (type string), a quantity of the item being purchased (typeint) and a price per item (type int). Your class should have a constructor that initializes the fourdata members. A constructor that receives multiple arguments is defined with the form:ClassName( TypeName1 parameterName1, TypeName2 parameterName2, ... )Provide a set and a get function for each data member. In addition, provide a member functionnamed getInvoiceAmount that calculates the invoice amount (i.e., multiplies the quantity by theprice per item), then returns the amount as an int value. If the quantity is not positive, it should beset to 0. If the price per item is not positive, it should be set to 0. Write a test program that demonstrates class Invoice’s capabilitiesComplete the code for the Student class method called void loadStudent(...) that receives a single string parameter. This string parameter will contain student details in the following format: ’Name’,’Surname’,’Email’,’Age’,’Student Number’ Write the code to separate the string and assign the correct values to the Student class members. Create an overloaded > (greater than) operator in the Student class. The operator will compare the age of two student objects and return the object with the greater age. In main.cpp create a non member function named isFemale. This function will receive as parameter a pointer to a student object. If the last two numbers of the student number is valid numbers (Must be between 0 and 9) the function will return true. Otherwise the function will return false. Overload the default constructor for Student to receive a single string parameter. This string parameter will contain student details in the following format:…
- C# (Odd or Even) Write an app that reads an integer, then determines and displays whether it’s odd or even. (Hints: use the remainder operator) (Multiples) Write an app that reads two integers, determines whether the first is a multiple of the second, and displays the result. (Hints: use the remainder operator). Create a class called Date that includes three pieces of information as auto-implemented properties: a month (type int), a day (type int), and a year (type int). Your class should have a constructor that initializes the three fields. Provide a method DisplayDate() that displays the three fields (separated by '/'). Write a test app named DateDemo that demonstrates class Date’s capabilities.1- A complex number has the form a+bi , can be expressed as theordered pair of real numbers (a,b). The class represents the real andimaginary parts as double precision values.Provide a constructor that enables an object of this class to beinitialized when it is instantiated. The constructor should containdefault values.Provide Public member functions for each of the followingarithmetic’s functions (addition – subtraction – multiplication –division), a complex absolute value operation, printing the number inthe form (a,b), printing the real part , printing the imaginary part andfinal overload the == operator to allow comparisons of two complexnumbers.Include any additional operations that you think would be useful fora complex number class.Design, implement, and test your class.Complete the Appointment class. The class should have the following instance variables, constructors) and instance methods: 1. A properlv encapsulated String instance variable named personName 2. A properly encapsulated String instance variable named day. 3. A properly encapsulated double instance variable named duration 4. A default(no-arg) constructor that sets the per sonName instance variable to "Your Boss", day instance variable to "Monday" and duration instance variable to 1.5. 1. An overloaded constructor that takes two String parameters and one double parameter and sets the instance variables to the values passed in. 2. A getter and setter method for each instance variable. .A method named printAppointment, the method returns a String which contains the concatenation of the instance variables as shown in the sample output
- Build a class named car. This class is defined as follows: It has the fields: Car ID, Car model , Car make, Car color, Car year. Build a constructor that accepts the five parameters (Car ID, Car model , Car make,Car color, Car year). Override the method toString() to return the string representation of Car ID, Carmodel , Car make, Car color, Car year.Class Student __init__(self, id: int, fist_name: str, last_name: str, town:str): """ This creates a student object with the specified ID first and last name and home town. This constructor should also create data structure for holding the students grades for all of there assignments. Additionally it should create a variable that holds the student's energy level which will be a number between 0 and 1. :param id: The student's identifiaction number :param fist_name: The student's first name :param last_name: The student's last name :param town: The student's home town """ get_id(self)->int: """ Returns the ID of the student as specified in the constructor. :return: The student's ID """ get_first_name(self) -> str: """ Returns the first name of the student. :return: The student's first name """ set_first_name(self, name:str): """ Changes the student first name to the specified value of the name parameter. :param name: The value that the first name of the student will equal. """…Child Class: Vegetable Write a child class called Vegetable. A vegetable is described by a name, the number of grams of sugar (as a whole number), the number of grams of sodium (as a whole number), and whether or not the vegetable is a starch. Core Class Components For the Vegetable class, write: the complete class header the instance data variables a constructor that sets the instance data variables based on parameters getters and setters; use instance data variables where appropriate a toString method that returns a text representation of a Vegetable object that includes all four characteristics of the vegetableJava