Create a calculator for the number by creating a class of number with overloading all operators in it.(Operators: +,- *, >>, <<).
Q: 2. Here is the API for a robot library. // moves the robot forward function moveForward(); // turns…
A: Explanation: If bottom-leftmost block is labelled as (0, 0), The operations in option A will make…
Q: Given the following sample code: public class Example{ public float Twin(float a, float b) {.. }…
A: By Replacing overloading from overriding Explanation:- This is the correct option because in…
Q: Write a program that use two classes. Calculate the factorial of a given number by using one class…
A: Constructors are the functions which have same name as class name and whenever an instance is…
Q: How does one go about constructing an ADT? With your comment, fill in the spaces.
A: ADT: The standard definition of the ADT in C is a pointer to a structure. It is up to the…
Q: Define a new "Degree" class that contains a year (integer), a subject (string) and a person's name…
A: Hey there, I am writing the required solution based on the above stated question. First, I will…
Q: Can you have more than one constructor in a program? Write a program to find area of a triangle…
A: Actually, program is a executable software that runs on a computer.
Q: Question: 2 Implement the design of the Chillox and Customer classes so that the following code…
A: Algorithm: Start Create Chillox class with menu and order_id as its static varibales Implement…
Q: Create a class Int based on Question-5 in Assignment-2. Overload four integer arithmetic operators…
A: Note: Here you didn't mention any programming language so we are creating the program in the C++…
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: Find the error in the following given codes and rewrite. a). public interface intt { public void P1…
A: Key concepts:- Interfaces consists of only method declaration(without body). Interfaces containing…
Q: Write a program namedAveragesthat includes a method that accepts any number ofnumeric parameters,…
A: C# is a new, general-purpose programming language that can be used to make a wide range of tasks and…
Q: Implement the design of the EPL_Team class so that the following output is produced: Driver Code…
A: class EPL_Team:def __init__(self,name,*args):self.name=nameif…
Q: A string of ( {[]}) is given and you have to check this valid parenthesis. Means if a braces is…
A: write a java program to check the valid parenthesis, create a separate class named solution, and…
Q: Question: 2 Implement the design of the Laptop and Store classes so that the following code…
A: Algorithm: Start Create a class Store with laptops a list as static variable and name as instance…
Q: Write a program to swap the values of private data members of a class named as class_1 and class_2…
A: Friend Function in C++ is used to access private and protected data of a class. Using keyword…
Q: Drag and drop from the options below to declare an object of type "People", which takes a string as…
A: Declare an object of type "People", which takes a string as the first parameter for its constructor…
Q: When you print an instance of the class Food in Question 1, you get something like this: Building…
A: code : - class Food: def __init__(self,name,taste): self.name = name self.taste =…
Q: Write a test class to test the methods length, charAt, substring, and indexOfin the java.lang.String…
A: String class methods and their descriptions: Method Description length() The length() method…
Q: Write a program by creating an 'Employee' class having the following functions and print the final…
A: Required: To Write a program by creating an 'Employee' class having the following functions and…
Q: Q5: Correct the following code fragment and what will be the final results of the variable a and b…
A: Dear student, the answer is provided below.
Q: Correct the following code fragment and what will be the final results of the variable a and b:…
A: Your correct code fragment is given below with an output.
Q: Find all the things that are wrong with the following declaration. Enum Pet = { "dog", "cat",…
A: The wrong things in this declarations are: The keyword is wrong = Enum The statement should end…
Q: There is a class called Roster whose constructor that takes a List of tuples with the names of…
A: Question given: Create a class that accepts a list of tuples. Tuples have student data (name and…
Q: For the Employee class, create the following: A private String instance variable m name. A private…
A: Screenshots of the code: 1.
Q: In this exercise, you are going to create the Problem class. The Problem class is used to help…
A: Given code:- import java.util.*;class ProblemTester{String x;ProblemTester(String op,int min,int…
Q: Drag and drop from the options below to initialize members in the constructor initializer list, and…
A: A constructor is a special function that is used to initialize the variables of an object of a…
Q: Given a list of strings of bracket characters: {}), the string of brackets is balanced under the…
A: import java.util.*;import java.lang.*;//Parser classclass Parser{ //isBalanced function that…
Q: Use this exercise to test your code that you wrote in the previous exercise. Problem Class In this…
A: Java Source Code: import java.util.*;class JavaApplication1{String x;JavaApplication1(String op,int…
Q: Suppose we have a class for songs. A partial definition of this class is: public class Song { …
A: Find the code attached.
Q: Inside class StaticMethods., create the static and OVERLOADED method cubeNumber that takes as an…
A: use Double.parseDouble to convert string to double.
Q: What is the definition of encapsulation?
A: let us see the answer:- Introduction:- The concept of encapsulation (or OOP Encapsulation) in…
Q: Question: Implement the following functions in your class: getTotalWords (returns the amount of…
A: import sysdatafile='covid1.txt'datafile_data=[] #list of all words in the datafiledatafile_temp=[] #…
Q: Q4 a. Using user-defined classes and methods only write a C++ program to solve for the equation…
A: C++ program to solve the given problem.
Q: Implement the below class. Car - plateNumber: String - horsePower: int - year: int - nbCarsCreated:…
A: The required Java code is given below: public class Car { // class Car…
Q: Can we have more than one destructor in a class? Write a program to add two complex numbers using…
A: No, we cannot have more than one destructor in a single class. It is the rule of destructor that…
Q: How this can work without these empty constructors ? #include using namespace std; class Lecturer…
A: A constructor is a member function of a class which initializes data members of a class. A…
Q: Please implement a class called CPlusPlus with 2 member variables int number and follow by char ch
A: Check the code below.
Q: Question: 2 Implement the design of the Groceries and Buyer classes so that the following code…
A: I have the same implement program which I done few days and it more useful than this
Q: D) Have the main method do the following: • Instantiate two instances of the Circle class with…
A: logic:- define circle class with attributes radius and Color. Inside this class define method…
Q: Correct the following code fragment and what will be the final results of the variable a and b:…
A: The Answer is
Q: there is a ternary operator like this int x= a>b ? a : b ; so there is 3 number ,x,,y,z if…
A: so, here we have to convert the if-else logic code to , using Ternary Operator code. we can do it…
Q: A word is on the loose and now has tried to hide amongst a crowd of tall letters! Help write a…
A: In order to implement the function, the crowded word with extra letters is sent to the function as…
Q: Consider the following code: 1. public class Circle { private int radius; private int x; private int…
A: C) the address of the Circle object
Q: 1. Implement the following classes: Person Employee - name: String - gender: String - age: int -id:…
A: Given person class, employee class, faculty class and in main method we have to create a faculty…
Q: The following is a valid code to call the CONSTANT from class "MyClass"
A: The answer is True. The following snippet can prove the answer:
Step by step
Solved in 2 steps
- Assignment 4 - Car Maintenance This assignment will assess your understanding of void and value returning static methods. Your cousin owns an automotive maintenance shop that performs routine maintenance on cars. He has asked you to write a program that will provide a list of services (and their respective prices) to users and allow them to choose any, or all, services they would like and display the final price, including a 28% labor charge, a 9% markup if the car is an import, and an 8% sales tax. Task To accomplish the above, do the following: • Write the two methods outlined below. • Test your program and screenshot your successful test. carMaintenance method This method should accept the make of the car as a parameter (e.g., BMW, Ford, Ferrari, etc.). It should display the services and their prices as follows: Services: Oil Change, Tune up, Brake Job, Transmission Service, respectively: 59.99, 111.99, 189.99, 149.99 These should be stored in parallel arrays. Ask the user to…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…In C++ Language: Suppose I have a class named Person. Here is how I would like to use the class: //Create a person named Dave Smith Person dave("Smith", "Dave", 'R'); //Create a person named Gal Gadot Person gal("Gadot", "Gal", 'G'); //Dave and Gal gets married gal = dave + gal; dave = dave + gal; //print Gal and Dave's new married name cout << gal << endl; cout << dave << endl; This will output the following: Gal Smith-Gadot Dave Smith-Gadot Write the class declaration for Person
- 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.Java program Car Maintenance: This assignment will assess your understanding of void and value returning static methods. Your cousin owns an automotive maintenance shop that performs routine maintenance on cars. He has asked you to write a program that will provide a list of services (and their respective prices) to users and allow them to choose any, or all, services they would like and display the final price, including a 28% labor charge, a 9% markup if the car is an import, and an 8% sales tax. Task To accomplish the above, do the following: • Write the two methods outlined below. • Test your program and screenshot your successful test. carMaintenance method This method should accept the make of the car as a parameter (e.g., BMW, Ford, Ferrari, etc.). It should display the services and their prices as follows: Services: Oil Change, Tune up, Brake Job, Transmission Service, respectively: 59.99, 111.99, 189.99, 149.99 These should be stored in parallel arrays. Ask the user to…Redo Programming Exercise 3 by overloading the operators as nonmembers of the class boxType. Write a test program that tests various operations on the class boxType.
- Case Problem 1 - In previous chapters, you developed classes that work with catering event information for Carly’s Catering. Now modify the Event and EventDemo classes as follows: Modify the Event class to include an integer field that holds an event type. Add a final String array that holds names of the types of events that Carly’s caters—wedding, baptism, birthday, corporate, and other. Include get and set methods for the integer event type field. If the argument passed to the method that sets the event type is larger than the size of the array of String event types, then set the integer to the element number occupied by other. Include a get method that returns an event’s String event type based on the numeric event type. To keep the EventDemo class simple, remove all the statements that compare event sizes and that display the invitation Strings. Modify the EventDemo class so that instead of creating three single Event objects, it uses an array of three Event objects. Get data for…Java Questions - (Has 2 Parts). Based on each code, which answer out of the choices "A, B, C, D, E" is correct. Each question has one correct answer. Thank you. Part 1 - 9. In Java, composition is said to use __ relationship. A. is-aB. part-ofC. has-aD. both is-a and part-ofE. both has-a and part-of Part 2 - 10. Given the following code, which statement is true? class Water() { ... }class Juice() extends Water { ... }class Apple() { ... }class ApplePie() { Apple a1 = new Apple(); }class AppleJuice() { Apple a1 = new Apple(); Water w1 = newWater(); } A. Juice is a superclass and Water is a subclass.B. ApplePie is a superclass of Apple.C. ApplePie is a composite class that contains an instance of Apple class.D. AppleJuice is a superclass that contains an instance of Apple class and an instance of Water.E. Water is a composite class that contains an instance of Juice.Assume method testQuestion() is a method in the Purchase class. Assume the Purchase class has a constructor that has parameters of name, groupCount, groupPrice, and numberBought. public Purchase testQuestion(Purchase p1, int newX) { newX = 20; this.setName("green beans"); p1.setName("corn"); Purchase p2 = new Purchase("broccoli", 5, 4.50, 10); return p2; } Referring to the above method, list the output that would be printed by Sysyem.out.println() when the following PurchaseDemo2 is executed. public class PurchaseDemo2 { public static void main(String[] args) { Purchase tomsPurchase = new Purchase("squash",4,3.50,6 ); Purchase jillsPurchase = new Purchase("carrot",8,1.99,4 ); Purchase billsPurchase;…
- A __________ is a constructor that accepts no arguments.C++ PLEASE!!! Complete the EagleNode class destructor. The destructor prints "EagleNode with ", followed by the value of eaglets, then " eaglets is deallocated.". End with a newline. Ex: If the input is 3, then the output is: EagleNode with 3 eaglets is deallocated.Use following main() to test your class.int main(){Vehicle a,b("Honda","Civic",25000);cout<<a.getBrand()<<endl; cout<<a.getModel()<<endl; cout<<a.getPrice()<<endl; cout<<b.getBrand()<<endl; cout<<b.getModel()<<endl; cout<<b.getPrice()<<endl; } #include <bits/stdc++.h>using namespace std;class Vehicle { string brand; int price; string model; public: string getBrand(); string getModel(); int getPrice(); void setBrand(string a); void setModel(string b); void setPrice(int i); }; string Vehicle::getBrand() { return brand;} void Vehicle::setBrand(string a) { brand = a;} string Vehicle::getModel() { return model;} void Vehicle::setModel(string b) { model = b;}int Vehicle::getPrice() { return price;} void Vehicle::setPrice(int i) { price = i;} int main() { Vehicle a; a.setBrand("BMW");a.setModel("X5");a.setPrice(60000);cout<<a.getBrand()<<endl; // print…