Design a class name Fruit Basket offering multiple baskets to the customer. purchaseBasket(int apples, int mangoes, int bananas):The first basket contains the combination of apples,mangoes and bananas purchaseBasket(int pineapples, intpomogranates):The second basket contains the combination of pomegranates and pineapples. purchaseBasket (intapples);The third basket only apples. The customer can set the quantity of the fruit in the basket, your method will return the amount that customer need to pay for the purchased basket.
Q: This composition example contains classes Date, Employee and EmployeeTest .Class Date declares…
A: public class Date{ //instance variables used to store Date private int day; private int month;…
Q: A complex number has the form a+bi , can be expressed as the ordered pair of real numbers (a,b). The…
A: Program code: //include the header files #include<iostream> using namespace std; //Create a…
Q: Question 1 Directions : Extend class Drink to make a unique type of drink class. (Your drink should…
A: In object oriented inheritance is feature that allows a class to inherit the properties of another…
Q: Consider the following class definition. public class Liquid { private double boilingPoint; private…
A: Here is the explanation about the behavior of the program:
Q: Write a program to model the kinds of people one finds in a university. The categories are students,…
A: The following classes are used in the program. Person abstract class. Student class as a subclass…
Q: Indications: Person is an abstract class containing the abstract method Print(). In Teacher and…
A: We need to implement the University Class and Main.java as per the given description.
Q: Add the following new constructor in the BMI class:/** Construct a BMI with the specified name, age,…
A: Program code: File name: BMICalculation.java //import the required packages import…
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: Create a class Date, with data members Day, Month and year. . Overload the constructor in Date, and…
A: class Date { Public: Date( string )…
Q: Write code for an Invoice class for a car sale. Printing an object of the Invoice should print the…
A: 1.) The method signature is basically a declaration of the instance function in the base class so…
Q: Create an interface Wheel with methods setWheels (int c) and getWheels () and a class Vehicle with…
A: Create an interface Wheel with methods setWheels (int c) and getWheels () and a class Vehicle with…
Q: a) Write a complete class called Cinema with the following methods: i. Default/Normal and Copy…
A: Following is the java code for Cinema.java and CinemaApp.java (comments are provided inline within…
Q: QUESTION 2 Create an instance of the Time class called time1. It should have an initial time with…
A: The Answer is in step2
Q: An airport van shuttles passengers between the terminal and the parking garage. After 4 trips, the…
A: According to the information given:- We have to follow the instruction to rearrange the mention code…
Q: Suppose that you are in charge of customer service for a certain business. As phone calls come in,…
A: Answer: The Main program have all the methods to test the methods in the ServiceRequests class…
Q: A class called Customer (as shown in the class diagram above) is designed to model a customer. It…
A: Step 1 : Start Step 2 : Defining the class Customer and inside it declare the Data members. Step 3 :…
Q: Design a class called Flight that will store data about a commercial flight. Data includes:…
A: Begin Enter the details of the flight Display the details of the flight End
Q: using c++ oop !!! kindly need help asap. Implement the shape, rectangle, and square classes with…
A: The question is to write c++ code for the given problem.
Q: 2019 AP® COMPUTER SCIENCE A FREE-RESPONSE QUESTIONS 2. This question involves the implementation of…
A: Note: As you have not mentioned any programming language, the program is written in JAVA language.…
Q: You are asked to write a discount system for a beauty saloon, which provides services and sells…
A: Now lets see the classes from package com.java.discountsystem.constantDiscountRate.java package…
Q: Use java programming language 1.1 Create a Student Object project. Create a Student class and use…
A: Student.java =================== import java.util.Random; public class Student { //declare variables…
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: magine a publishing company that markets both book and audiocassette versions of its works. I it…
A: code in c++
Q: Suppose there is a class Eye already created and has constructors and get and set methods. Write the…
A: Given data is shown below:
Q: You are asked to write a discount system for a beauty saloon, which provides services and sells…
A: PROGRAM INTRODUCTION: Import the required libraries. Start definition of customer class. Declare…
Q: using c++: Write a class service (servant_name, tip, and the static total_tip and static…
A: /******************************************************************************…
Q: Create a class JobApplicant that holds data about a job applicant. Include a name and four boolean…
A: Since the programming language is not mentioned , I have done the code in Java. Algorithm : Step 1…
Q: Write the program, which has two classes one, is Date having members (day, month, year) and the…
A: PROGRAM CODE: #include <iostream>#include <string.h> using namespace std; class Date1{…
Q: Using C++, write a class that has the following properties and represents an airline flight from…
A: Class is a user-defined data type that encapsulates the data members or attributes and member…
Q: Given the following statement: Paper paper = new Paper("A4", 80); where "A4" is the paper size and…
A: Step 1st: Private Attributes of papersize and paperweight; Step 2nd: Constructor of Paper class Step…
Q: Person and Customer Classes Write a class named (Person) with data attributes for a person’s…
A: # Creating Person class class Person: # constructor def __init__(self, name, address,…
Q: Suppose a call center has three levels of employees: respondent, manager, and director. An…
A: Solution :: Let's see first what is Java and its uses ? Answer :: Java is a general-purpose,…
Q: O Challenge task Write the code of the Constructors and Distructor for the following class 1-Write…
A: Include header files Define a class with class name constructor and data member X and Y as integers…
Q: A single class can have many instances of that class it’s true or false
A: The answer is...
Q: Class EmployeeTest creates two Date objects to represent an Employee’s birthday and hire date,…
A: public class EmployeeTest{ public static void main(String[] args) { Date d1=new…
Q: a. Add a nested class to Stock named Company. Company contains the following fields: (i) name, (ii)…
A: import dependencyanalysis.Stock.Company; public class StockTester { public static void…
Q: Write code for an Invoice class for a car sale. Printing an object of the Invoice should print the…
A: 1.) The method signature is basically a declaration of the instance function in the base class so…
Q: Write a class encapsulating the concept of the weather forecast, assuming that it has the following…
A: Since programming language is not mentioned in the question, we will answer this question in the…
Q: Write GroceryChain class with instance variables and a constructor. Each GroceryChain has a name,…
A: public class GroceryChain { String name; int noOfStores; double annualRevenue; public…
Q: Write a tester program to test the mobile class defined below. Create the class named with your id…
A: An object for a class can be created using constructor and memory is allocated using new keyword.…
Q: The BankAccount class described below is used to represent a personal savings account with a yearly…
A: class BankAccount { public BankAccount(double rate) { this.intRate = rate; }…
Q: Write a class named Rabbit to model a rabbit. The UML diagram for the class is shown below. Rabbit…
A: As per the requirement program is developed. Note: In the question programming language is not…
Q: A furniture store specializes in office furniture and sells Office Chairs, Desks and Book Shelves.…
A: The ask is to build a program doing the following: - menu-driven options - Create classes for…
Q: Create a UML Diagram of a class named Investment with fields called principal and interest. It also…
A: UML Diagram of a class named Investment with fields called principal and interest. It also contains…
Q: A shuttle van picks up passengers and drives them to a destination, where they leave the van. Keep a…
A: PROGRAM EXPLANATION: - The Van class comprise of three instance variables namely maxPassengers,…
Q: Class Employee Employee -Name (string) -ID(integer) -Address(string) -Salary(double)…
A: Find the required code in java as language not specified given as below and output :
Q: Write a class definition line and a one line docstring for the class Dog. Write an init__ method for…
A: The given problem is related to Python class creation, import of class and creation of objects of…
Q: QUESTION 1 Write a full program for an electrical shop based on the following information whereby a…
A: import java.util.Scanner;public class ElectItem{ Product item; Brand brandName; int…
Q: A class called Book is designed (as shown in the class diagram) to model a book written by one…
A: Actually, java is a object oriented programming language.
Attach SS of the output.
Create an Oop Java program.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images
- You are asked to write a discount system for a beauty saloon, which provides services and sells beauty products. It offers 3 types of memberships: Premium, Gold, and Silver. Premium, gold and silver members receive a discount of 20%, 15%, and 10%, respectively, for all services provided. Customers without membership receive no discount. All members receives a flat 10% discount on products purchased (this might change in the future). Your system shall consist of three classes: Customer, DiscountRate and Visit, as shown in the class diagram. It shall compute the total bill if a customer purchases $x of products and $y of services, for a visit. Also, write a test program VisitDriver (are not to be graded and optional) to exercise all the classes. Important: "Visit Class diagram - ERROR" Constructor method of Visit class must recieve Customer object instead of String name. Visit(Customer customer, Date date) The class DiscountRate contains only static variables and methods (underlined in…Complete the FoodItem class by adding a constructor to initialize a food item. The constructor should initialize the name (a string) to "None" and all other instance attributes to 0.0 by default. If the constructor is called with a food name, grams of fat, grams of carbohydrates, and grams of protein, the constructor should assign each instance attribute with the appropriate parameter value. The given program accepts as input a food item name, fat, carbs, and protein and the number of servings. The program creates a food item using the constructor parameters' default values and a food item using the input values. The program outputs the nutritional information and calories per serving for both food items. Ex: If the input is: M&M's 10.0 34.0 2.0 1.0 where M&M's is the food name, 10.0 is the grams of fat, 34.0 is the grams of carbohydrates, 2.0 is the grams of protein, and 1.0 is the number of servings, the output is: Nutritional information per serving of None: Fat: 0.00 g…Question: 2 Implement the design of the Purchaser and AarongProducts classes so that the following code generates the output below: #Write your code here p1 = Purchaser('Alex Light') print('1.===============================') print(p1) product1 = AarongProducts('Decor', 'Photo-Frame') print('2.===============================') print(product1) print('3.===============================') print(AarongProducts.products) print('4.===============================') AarongProducts.include_products('Souvenirs',['Brass-Flowervase 2170', 'Terracotta-Vase 3500']) print(f'Updated Item List:\n{AarongProducts.products}') print('5.===============================') product2 = AarongProducts('Souvenirs', 'Terracotta-Vase', 2) print(product2) print('6.===============================') p1.create_invoice(product1, product2) print('7.===============================') product3 = AarongProducts('Decor', 'Candles', 5) print(product3) print('8.===============================') product4 =…
- Question: 2Implement the design of the Chillox and Customer classes so that the following code generates the output below:print(f"It's been a good day!. \nToday, we have already served {Chillox.order_id} customers.")print("**************************************************")outlet1 = Chillox()print("1.==========================================")print("Burger Menu:")print(Chillox.menu)print("2.==========================================")outlet1.addBurger("Chicken Burger",180,"Chicken with Cheese",200)print("3.==========================================")print("Burger Menu:")print(Chillox.menu)print("4.==========================================")c1 = Customer("Samin")c1.order = "2xChicken Burger"outlet1.placeOrderof(c1)print("5.==========================================")outlet1.addBurger('Chicken Smoky BBQ Cheese',225)c2 = Customer("Rafi")c2.setOrder("2xChicken with Cheese,3xChicken Smoky BBQ…The 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…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 method checkMonth to validate the month—if the value is out-of-range the method throws an error message. same goes for year and day. Provide getters, setters and toString method. Class Employee has instance variables firstName, lastName, birthDate and hireDate.Members firstName and lastName are references to String objects. Members birthDate and hireDate are references to Date objects. This demonstrates that a class can have as instance variables references to objects of other classes. The Employee constructor takes four parameters—first, last, dateOfBirth and dateOfHire. The objects referenced by the parameters are assigned to the Employee object’s instance variables. When class Employee’s toString method is called, it returns a String containing the employee’s name and the…
- 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 method checkMonth to validate the month—if the value is out-of-range the method throws an error message. same goes for year and day. Provide getters, setters and toString method. Class Employee has instance variables firstName, lastName, birthDate and hireDate.Members firstName and lastName are references to String objects. Members birthDate and hireDate are references to Date objects. This demonstrates that a class can have as instance variables references to objects of other classes. The Employee constructor takes four parameters—first, last, dateOfBirth and dateOfHire. The objects referenced by the parameters are assigned to the Employee object’s instance variables. When class Employee’s toString method is called, it returns a String containing the employee’s name and the…Can it be two classes, the Calculator class must instantiate the CalculatorFrame class and the CalculatorFrame class must be where the calculator gets built.write a discount system for a beauty saloon using java program, which provides services and sells beauty products. It offers 3 types of memberships: Premium, Gold and Silver. Premium, gold and silver members receive a discount of 20%, 15%, and 10%, respectively, for all services provided. Customers without membership receive no discount. All members receives a flat 10% discount on products purchased (this might change in future). Your system shall consist of three classes: Customer, Discount and Visit, as shown in the class diagram. It shall compute the total bill if a customer purchases $x of products and $y of services, for a visit. Also write a test program to exercise all the classes. Don’t forget to use array customer name and member type.
- This question involves the design of a class that will be used to produce practice problems. The following StudyPracticeinterface represents practice problems that can be used to study some subject. public interface StudyPractice. { /**Returns the current practive problem */ String getProblem(); /** Changes to the next practice problem */ void nextProblem(); } The MultPractice class is a StudyPracticethat produces multiplication practice problems. A MultPractice object is constructed with two integer values: first integer and initial second integer. The first integer is a value that remains constant and is used as the first integer in every practice problem. The initial second integer is used as the starting value for the second integer in the practice problems. This second value is incremented for each additional practice problem that is produced by the class. For example, a MultPractice object created with the call new MultPractice (7, 3)would be used to create the practice…Imagine a publishing company that markets both book and audiocassette versions of its works. I it markets both book and audiocassette versions of its works. create a class called publication that stores the title (a string) and price (type float) and date of a publication. Provide getters/setters and constructor also write an abstract method isOversize() .From this class derive two classes: book, which adds a page count (type int); and tape, which adds a playing time in minutes (type float). Each of the classes should have a getter/setters and constructors and provide definition to function called isOversize() to the book and tape classes. Let’s say that a book with more than 800 pages, or a tape with a playing time longer than 90 minutes (which would require two cassettes), is considered oversize. You can access this function from main() and display the string “Oversize” for oversize books and tapes when you display their other data. explain the working in your wordsImagine a publishing company that markets both book and audiocassette versions of its works. I it markets both book and audiocassette versions of its works. create a class called publication that stores the title (a string) and price (type float) and date of a publication. Provide getters/setters and constructor also write an abstract method isOversize() .From this class derive two classes: book, which adds a page count (type int); and tape, which adds a playing time in minutes (type float). Each of the classes should have a getter/setters and constructors and provide definition to function called isOversize() to the book and tape classes. Let’s say that a book with more than 800 pages, or a tape with a playing time longer than 90 minutes (which would require two cassettes), is considered oversize. You can access this function from main() and display the string “Oversize” for oversize books and tapes when you display their other data.