Write a main() program to test the book and tape class by creating instances of them, asking the user to fill in their data with getdata() and then displaying the data with putdata().
Q: Write a resource class that has the deposit, withdrawal, and print balance methods. Next, implement…
A: ## As no programming language is mentioned, the code is written in Python. class Resource:…
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: Write a Java class, XXX_Lab7-3, where XXX is your Kean email ID. In the main method:* Create an…
A: Writing a java Program to create a class name XXX_Lab7-3. In this program there are two arrays, one…
Q: In an mit school we have 2 objects and we have to merge them One object has student name, age,…
A: Requirements:- In an MIT school, we have 2 objects and we have to merge them One object has student…
Q: In java How to compare two objects in java? for example :- take one number of long type and other…
A: approach :- given two numbers and you have to create two object of double and long class with…
Q: Modify the ClockPane class to drawthe clock with more details on the hours and minutes, as shown in…
A: Program: //Import required pacakgesimport javafx.application.Application;import…
Q: Write a program in JavaScript to make a copy of object and then change the name of the key which is…
A: Required:- Write a program in JavaScript to make a copy of the object and then change the name of…
Q: Create an instance of the Transcript class with a statement.
A: Creation of objects: A class is a collection of user-defined data structures that include fields,…
Q: Give ReadFromFile a name and a description.
A: Introduction: The ReadFromFile method reads from a file the value of a string or binary field.
Q: Consider a class PersonAddress that represents an entry in an address book. Its attributes are The…
A: ANSWER:-
Q: What is printed by the code below? Note: There are two separate classes here. public class…
A: Answer : The above code is of Java Programming, and we need to find out the output of the given…
Q: Write a program that creates a model that uses the percentage of individuals with bachelor's degrees…
A: CSV files are simply comma separated value files. In the given 'internetusage.csv' file, data is…
Q: Suppose a Scanner object is created as follows, what number? (Hint: a real number are all numbers,…
A: I have given answer below for given question.
Q: Give a brief description of WriteStackFrame.
A: Intro the above question is about Give a brief description of WriteStackFrame.
Q: Implement the design of the Pizza class so that the following output is
A: pizza_count is a class level variable or static variable which is shared by all the instances of…
Q: Consider a piece of online banking software that includes a hidden function that allows the…
A: Start: We are going to explore whether or whether someone (the developer) has incorporated a hidden…
Q: Consider a class that keeps track of the students in a session. An object of this class will have…
A: Given, • Total number of students• Total number of scholarships awarded• Scholarships per student•…
Q: What is the distinction between the static and extern storage classes? Give appropriate instances in…
A: Intro Explanation : The storage category must be visible with the variable location. It tells us…
Q: Implements an interface having three methods eat, travel, bark in class ANIMAL having three child…
A: Program Plan: Create an interface named Animal In that interface declare methods…
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: This BST class leaks memory. In the space below, define a method that will fix the memory leak.…
A:
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: write a program to print the names of the student by creating a student class .if no name is passed…
A: Using Constructor #include <iostream> using namespace std; class Student{ public: string…
Q: Please write an email class using OOP concept to send an email with "Information Technology" for the…
A: -> Everything is explained in code via comments import java.util.*;import javax.mail.*;import…
Q: • Write a complete Java program that uses "NullPointerException" Attach your code along with the…
A: In java a NullPointerException is a type of RuntimeException that occurs when a program tries to…
Q: Write a program to print the names of books by creating a book class. If no name is passed while…
A:
Q: Give Description for WriteStackFrame
A: WriteStackFrame is used for displaying the contents of the current procedure's stack frame. It shows…
Q: Write the Python class Lunchltem. Instances of this class represent an item that can also be served…
A: class MenuItem: def __init__(self,name,isVeggie,price): self.name=name…
Q: Write an OOP program that includes a class named "Shape". Next, create two objects from the class;…
A: class Shape{ public void print_shape(){ System.out.println("This is shape"); } } //…
Q: Write a program to test the class LinkedBag.
A: write a java program to test the calss linked bag
Q: Below I have a sample class written in java and have several methods. I have only written the…
A: For user: public interface User { public double getname () {} public string getID ()…
Q: Write short notes on a) Checked and unchecked keyword b) Partial and sealed classes
A: a) Checked and Unchecked keyword : The checked keyword is usually used when there is a condition of…
Q: Write a resource class that has the deposit, withdrawal, and print balance methods. Next, implement…
A: Write a resource class that has the deposit, withdrawal, and print balance methods. Next, implement…
Q: Suppose that in a kitchen there is only one four-burner stove to be used both for frying pans and…
A: Answer: I have done code and also I have attached code as well as code screenshot output.
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: Create a Java Project (with a class and a test class) to represent some real-world entity such as a…
A: We'll use a real-world animal to fulfill all of the conditions.
Q: public static CS150 getInstance(){ //TODO implement a single return null; }
A: public static CS150 getInstance(){ return (new CS150()); }
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: Declare a class Combolock that works like the combination lock in a gym locker,
A: As per our need, we want a 3 number lock. So we have used a random module in java to create 3…
Q: the Card.java class file, write a program to simulate a Deck of Cards. See Programming Project 8.7…
A: It is defined as a class-based object-oriented programming language for building web and desktop…
Q: What is wrong in the following code? How it can be fixed without changing the visibility modifiers?…
A: Given Code : Error 1 : in line 4 a.x cannot be accessed because x is a private member of class A.…
Q: Write a method that takes an integer value from user and returns the binary representation of the…
A: According to the Question below the Complete Program: Program Output:
Q: Write the full command line to compile the C source file called map.c, and put the executable…
A: For a C program to compile we need compiler. For the linux distros and macOS the gcc is c compiler…
Step by step
Solved in 3 steps with 1 images
- 1. Write a class to calculate the distance between two massive objects using using Newton's law of universal gravitation. Use it to determine the distance between the Earth and the Moon in kilometres. Then use it to determine the distance between the Earth and the Sun in kilometres. ?=??1?2?2F=Gm1m2r2 You may find the following values useful: Gravitational Constant: ?=6.674×10−11 m3kg−1s−2G=6.674×10−11 m3kg−1s−2 Mass of the Earth: ?⊕=5.972×1024 kgM⊕=5.972×1024 kg Mass of the Moon: ?=7.348×1022 kgm=7.348×1022 kg Mass of the Sun: ?⊙=1.989×1030 kgM⊙=1.989×1030 kg Force of attraction between the Earth and the Moon: ?=1.986×1020 NF=1.986×1020 N Force of attraction between the Earth and the Sun: ?=3.6×1022 NF=3.6×1022 N Please give proper explanation and typed answer only.Imagine a publishing company that markets both books and audio-cassette versions of its works. Create a class publication that stores the title (a string) and price (type float) of a publication. From this class derive two classes: book with which adds a page count (type int) and tape which adds a playing time in minutes (type float). Each of these three classes should have a getData() function to get its data from the user at the keyboard and a putData() function to display its data.Given the base class Book, define a derived class called Encyclopedia. Within the derived Encyclopedia class, define a print_info() method that overrides the Book class' print_info() method by printing not only the title, author, publisher, and publication date, but also the edition and number of volumes. Ex: If the input is: The Hobbit J. R. R. Tolkien George Allen & Unwin 21 September 1937 The Illustrated Encyclopedia of the Universe James W. Guthrie Watson-Guptill 2001 2nd 1 the output is: Book Information: Book Title: The Hobbit Author: J. R. R. Tolkien Publisher: George Allen & Unwin Publication Date: 21 September 1937 Book Information: Book Title: The Illustrated Encyclopedia of the Universe Author: James W. Guthrie Publisher: Watson-Guptill Publication Date: 2001 Edition: 2nd Number of Volumes: 1 python code to be used: class Book: def __init__(self, title, author, publisher, publication_date):…
- Implement the design of the CSE and EEE classes that are derived from the Department class so that the following output is produced: Driver Code Output class Department: def __init__(self, s): self.semester = s self.name = "Default" self.id = -1 def student_info(self): print("Name:", self.name) print("ID:", self.id) def courses(self, c1, c2, c3): print("No courses Approved yet!") s1 = CSE("Rahim", 16101328,"Spring2016") s1.student_info() s1.courses("CSE110", "MAT110", "ENG101") print("==================") s2 = EEE("Tanzim", 18101326, "Spring2018") s2.student_info() s2.courses("Mat110", "PHY111", "ENG101") print("==================") s3 = CSE("Rudana", 18101326, "Fall2017") s3.student_info() s3.courses("CSE111", "PHY101", "MAT120") print("==================") s4 = EEE("Zainab", 19201623, "Summer2019") s4.student_info() s4.courses("EEE201", "PHY112", "MAT120") Name: Rahim ID: 16101328 Courses Approved to this CSE student in Spring2016 semester : CSE110 MAT110 ENG101 ==================…Consider the definition of the following class: public class CC { private int u; private int v; private double w; public CC( ) //Line 1 {…} public CC(int a) //Line 2 {…} public CC(int a, int b) //Line 3 {…} public CC(int a, int b, double d) //Line 4 {…} A. Give the line number containing the constructor that is executed in each of the following declarations: (i) CC one = new CC( ); _________________ (ii) CC two = new CC(5, 6); _________________ (iii) CC three = new CC(2, 8, 3.5); _________________ B. Write the definition of the constructor in Line 1 so that the instance variables are initialized to 0. C.Write the definition of the constructor in Line 4 so that the instance variables u, v, and w are initialized according to the values of the parameters a, b, and d,…Consider the following class declaration and variable definitions, then answer the following questions. #include <stdio.h> class A { private: class B { public: B() { x = 1; } int x; int& getx() { return x; } void print() { printf(“%d”,x); } }; private: B b; public: class C { private: int w; public: C() { w = 5; } B b; int &getw() { return w; } void print() { b.print(); printf(“%d”,w); } }; C c; void print() { b.print(); c.print(); } int& getx() { return b.getx(); } }; Assume each code snippet in each row below runs independently in a main function. For each one, say whether it's legal code or not. If it is, show the output and explain why it happens. If it’s illegal (e.g. syntax error), explain why. Try to do it without running the code, and then check and correct your answers as needed. # Code snippet Errors? (Yes or No) Output or explanation of error. 1…
- Build a class Pet having the following data membersa. Name (String)b. Gender (char)c. Type (String)d. Age (int)e. Weight (float)f. healthCondition (int)Imagine this class Pet represents your pet as a virtualobject. Provide constructors with arguments for name,gender, type, age and weight. Initialize healthCondition to 5(which means healthy). Provide getter for each of these but setter for only weight. Provide a function eat(String food). This function represents the action of eating thatwould increase the weight of the pet according to following rulesFood Increase In WeightRed Meat 0.14 kgChicken 0.12 kgPet Food 0.17 kgSupplement 0.1 kgFish 0.09 kgThe eat function returns the new Weight of the pet object.Provide another function fallSick() that reduces the healthCondition of the pet 1 but it cannot gobelow 0. Provide a function bool isDead() this function returns true if the healthCondition of a pet is 0and false otherwise. Add another function recover(). This function increases…Computer Science Use only NumPy to create the Normalize Class: Image Normalization is a technique used to touch up images that are too dark or too light for the human viewing experience. Implement a version that outputs images with full dynamic range (0–255 pixel intensity). In other words, for each color channel (r, g, b), rescale the range of pixel values for that channel to include both 0 and 255. After normalizing, there should be at least one pixel with a red value of 0, at least one pixel with a red value of 255, at least one pixel with a green value of 0, etc. To normalize a list of numbers nums to the range 0–n, set nums[i] = (nums[i]−min(nums))/(max(nums)−min(nums))∗n for all i. Be careful! When max(nums) == min(nums), you should not touch that list (why?).2) Consider the following class class Department { private: string name; const long locationNo; const longdeptId; intNumOfEmployees; static intnextDeptNo; static intnextLocationNo; public: Department( ); Department(string theName, totalEmps) void Print ( ) const; } Initialize both the values of nextDeptNo and nextLocationNo to 10000 Implement the default constructor to set the name to “Unknown”, locationNo to the current value of nextLocationNo, deptId to the current value of nextDeptNo and NumOfEmployees to zero. It should also increment the value of all static attributes by 1. Implement the other constructor to set the name and NumOfEmployees to the values that are passed to the contractor. The values of the locationNo and deptId should be assigned to the current values of nextLocationNo and nextDeptNo, respectively. This constructor should also increment the values of all static attributes by 1. The print function should print all values of all attributes (regular,…
- THIS IS A CODING QUESTION USING JAVA!!! using lambdas and streams. -create a class called subject -How do determine the 200 level courses etc, from the left it starts with 2 -Search is it available or not -We can use files Exercise: Using lambdas and streams whenever appropriate, write a program that manipulates subjects. Each subject has a code, title, number of credits, number of weekly lecture’s hours, and number of weekly tutorials hours. Using a menu, the user might need to sort subjects based on number of credits, tutorial hours, or lecture hours (one condition at a time). Moreover, the user might be interested in the following: -Use subject manager with methods to find the following: Display all 100-level subjects Display all 200-level subjects Display all 300-level subjects Display all subjects with 6 credits Display all subjects with 12 credits Display all CSCI subjects Display all CSIT subjects Guidelines: Please observe the following guidelines while writing your…Write a python code to create a class named as ‘Employee’ with attributes i.e. ID, Name, Designation, Qualification, Salary, Taken-Leaves, Allowed-Leaves and the functions applyLeave(). This function will take number of leaves as an input and check Allowed-Leaves to see whether the employee can take leaves or not. If he can take, deduct these leaves from Allowed-Leaves and add in Taken-Leaves. Otherwise show message ‘you cannot take leave’. Create another class ‘Intern’ and inherit ‘Employee’ as super class.5. Given the Java Point class (which contains two private variables x and y and constructors that allows creating a point object with known x and y values as well as other methods such as equals( ), toString( ) etc), (a). define a new class called Circle that contains private two variables: center which is a Point object from the Point class and radius which is of type double. The Circle class must have the following methods: (b). add a constructor which creates a circle object using a center point with x and y values and a radius as its parameters. (c). add a default constructor. ( (d). add an equals() method that can compare if any object is equal to a Circle object (two circle objects are equal if they have the same center point with the same radius). (e). add a toString() method that prints a Circle object with the center point and radius.