Given the following class definition, how would you instantiate it
Q: 2. Consider the following pseudocode. Including the initial parent process, how many processes, main...
A: The process can be denoted as a program in execution. The threads can be denoted as the part of a sa...
Q: Let's say that an employee's regular pay is rate times hours. If they work more than 40 hours, they ...
A: Assume and "hours" is the number of hours of an employee and "rate" is the hourly rate than the regu...
Q: Big-O Coding Exercise Show your solution and explanations.
A: Application of Big O in List Processing: While getting to elements of a linked list, speed is r...
Q: Convert the following machine code to its corresponding MIPS assembly instruction in the form If any...
A: Ans is given below steps;
Q: When did the mechanical computer first appear on the scene?
A: Given: When was the first time you saw a mechanical computer?
Q: Methodology about the practices and deliverables of matrices codes in python fundamentals
A: In Python different matrix manipulations and operations. Numpy Module provides different methods for...
Q: What are a few key computer hardware developments you expect to see over the next ten years? What im...
A: Given: What are some important computer hardware breakthroughs you anticipate in the next 10 years? ...
Q: A (blank) is a usable representation of a solution.
A: Answer: Design
Q: Question 1. Discuss a new technology in the engineering or computer science field, explaining: d. H...
A: The ethics in a code determine the proper usage of the code in a helpful and impactful way.
Q: ease calculate the running time and please discuss the best-case and worst case of Shellsort algorit...
A: Lets see the solution.
Q: What is required of an attacker in order for a sniffer attack to be successful? If an attacker has n...
A: Introduction: The act of intercepting or recording data carried over a network is known as snooping ...
Q: for the following Question im after a hand written solution Question: The temperature alone is ...
A: PROGRAM INTRODUCTION: Import the required libraries. Start the definition of the main function. Cre...
Q: discuss how to creat a non-executable stack and disuss the stack's exploitable wesknesaes
A: Introduction: Non-executable stack (NX) is a virtual memory insurance instrument that prevents shell...
Q: Exercise 3 – XHTML and JavaScript Using XHTML and JavaScript you have create a web page that allows ...
A: The HTML is a markup language used for creating static webpages, the JavaScript is a scripting langu...
Q: What Is The Concept Of Fa Also Known As Fsm ( Finite State Machine) ?
A: A finite state machine (FSM) is a sort of state machine in computer science that has a restricted se...
Q: could you create a Vehicle class (Vehicle.java), include 2 properties: make - String, mileage - dou...
A: Constructor :- A constructor is a technique which is utilized to instate the items. The constructor ...
Q: Determine result of the operation or contents of the destination, machine code, and the address rang...
A: Determine result of the operation or contents of the destination, machine code. and the address rang...
Q: Python code that creates plots of the Boston Housing dataset features versus the median home value (...
A: Dependencies pandas - To work with solid data-structures, n-dimensional matrices and perform exp...
Q: Make a flowchart where a program dispenses cash at an ATM machine that has been upgraded to dispense...
A: Since you needed the output screenshot I am attaching for both conditions thatis when amount is divi...
Q: Ada Lovelace is an important figure in mathematics for a variety of reasons.
A: Ada Lovelace: Ada Lovelace (1815-1852 AD) was Lord Byron and Annabella Milbanke's only child. She is...
Q: You are given a DFA A which accepts some language L. Describe a method to build an automaton B (it ...
A: Follow the Steps to construct a DFA. Step 1: Determine the minimum number of states required in the ...
Q: When was the first algorithm created?
A: Many additional algorithms were developed and documented over the next several hundred years. Indivi...
Q: a) How can we implement a stack using only a priority queue and one additional integer variable? Sho...
A: a) How can we implement a stack using only a priority queue and one additional integer variable? Sho...
Q: In Java how do you write the default constructor int product = 1; for (int i=0; I < ...
A: I give the code in Java along with output and code screenshot
Q: (The HyPoint class) Design a class named MyPoint to represent a point with x- and y-coordinates. The...
A: Answer
Q: Write a CSS rule that places a background image halfway down the page, tiling it horizontally. The i...
A: Introduction: The layout of a webpage is formatted using Cascading Style Sheets (CSS). Color, font, ...
Q: In terms of technology and trends, provide a brief history of evolution and computer systems.
A: INTRODUCTION: HISTORY OF TECHNOLOGY: As technology advanced, computer systems expanded at a breaknec...
Q: 10.4 (THE MYPOINT CLASS) Design a class named MyPoint to represent a p with x- and y-coordinates. Th...
A: I give the code in Java eclipse along with output and code screenshot
Q: Who were Ada Lovelace's role models and mentors?
A: she is role model for girls interested in careers in science, technology, engineering or mathemat...
Q: How does a compiler deal with an inline member function of a class?
A: Introduction: When you write code in one programming language (the source language), you can use com...
Q: - solution and expla
A: Big-O is the tightest upper bound of a function.
Q: 4) Refer to lecture 3 (slide #23) and use the PING test to find the time needed to communicate with ...
A: To use the ping command, open the command prompt. To do this, click Start, click Run, type cmd, and ...
Q: Write a program that displays the following two entries: the number 33777 and the ASCII character co...
A: Step-1: StartStep-2: Declare a integer variable num and initialize with 33777Step-3: Declare a char ...
Q: What are some of the best ways to put up a firewall ?
A: Introduction: All traffic is prohibited by default, and only specific traffic to recognised services...
Q: Implement the following C++ program in MIPS, upload the MIPS source code and the screenshot of prog...
A: Here is the source code of the C++ Program: - int multiply(int x, int y) { int product=0; if(x&...
Q: A computer consumes what kind of energy?
A: An electronic device for storing and processing data typically in binary form according to instructi...
Q: Explain any five assembler directives of 8086 microprocessor.
A: 8086 Microprocessor: It is the enhanced version of Intel 8085 microprocessor and designed by Intel i...
Q: What is the MIPS machine language code for the following instruction? Write opcode, rs, rt, rd, sham...
A: The opcodes in MIPS machine language are pre determined and can be easily converted into decimal val...
Q: Write a program to find the sum for the following series: اكتب برنامج لايجاد المتسلسله التاليه : (1*...
A: Program Explanation: 1) Implementing the header file. 2) Using the integers. 3) Using an if-else sta...
Q: NOTE (what your anawer will contain) 1 Use CPROKGBAMMING LANGUAGE ONLY 2. Use RECURSION type of prog...
A: Here in this question we have asked to write a program in c .which take some value of n..and print t...
Q: 4. You are given the following functions: int functionA (int a) { printf ("a-td\n", a); if (a--1) re...
A: The program is written in C Language. Check the program screenshot for the correct indentation. Plea...
Q: answer the following. A) *Trace the FFT followed by the IFFT on the following polynomial: 2x3 - ...
A: Use recursion, FFT: The FFT's core concept is to control and predominate. They partition the polynom...
Q: navigation tools in SAP Business One. Why do you think SAP Business One came up with this kind of de...
A: given - Describe and explain the part of the menu bar and navigation tools in SAP Business One. Why ...
Q: What is wrong in this Javascript function? /** * Adds event listeners * @param {string} id element'...
A: Hey there, I am writing the required solution for the bove stated question . In my point of view, t...
Q: List and explain the three types of software that are necessary for a company's operations
A: There are many software require in company but three most essential software listed below : Custom...
Q: How many references must you change to insert a node to a binary search tree? What is the average ti...
A: Question 1: How many references must you change to insert a node to a binary search tree? Answer: 2 ...
Q: . Briefly explain the following: a. Difference between page views and sessions. b. Difference ...
A: NOTE: As per Bartleby guideline, if there are multiple parts then we are allowed to solve first thre...
Q: Consider a 16-bit binary floating point number representation system: + SE EE EEE m | m | m т т т т ...
A:
Q: Write the program code for stochastic hill climbing and gradient descent in python (I need the code ...
A: SUMMARY: - Hence, we discussed all the points.
Q: You are given two arrays: Array1 and Array2. Array1 will be sorted. For each element v in Array2, yo...
A: Actually, python is a easiest programming language. It is a dynamically typed programming language.
Computer Science
Given the following class definition, how would you instantiate it?
public class ShoeClass {
String name;
String brand;
double price;
public ShoeClass(String name, String brand, double price) {
this.name = name;
this.brand = brand;
this.price = price;
}
}
Step by step
Solved in 2 steps
- 49. Consider the following class definition. public class Cylinder } private double baseRadius; private double height; public Cylinder () baseRadius = 0; height = 0; public Cylinder (double 1, double h) } baseRadius - 1; height = h; { public void set (double r, double h) } baseRadius = r; height = h; { public String toString () } return (baseRadius + It n + height); { public double SurfaceArea () return 2 * 3.14 * baseRadius height; public double volume () } return 3.14 baseRadius * baseRadius * height; { Which of the following statements correctly instantiates the Cylinder object myCylinder? (i) Cylinder mycylinder = new Cylinder (2.5, 7.3) : (ii) class Cylinder myCylinder = new Cylinder (2.5, 7.3); (ii) myCylinder new Cylinder (2.5, 7.3); %3D a. Only (i) b. Only (i) c. Only (iüi) d. Both (ii) and (ii)public class Player { private int jerseyNumber; private int rating; public Player(int jerseyNumber, int rating) { this.jerseyNumber = jerseyNumber; this.rating = rating; } public int getJerseyNumber() { return jerseyNumber; } public void setJerseyNumber(int jerseyNumber) { this.jerseyNumber = jerseyNumber; } public int getRating() { return rating; } public void setRating(int rating) { this.rating = rating; } @Override public String toString() { return "Jersey number: " + jerseyNumber + ", Rating: " + rating; }}public class RosterManager { private ArrayList<Player> roster; public RosterManager() { roster = new ArrayList<>(); } public void addPlayer(Player player) { roster.add(player); } public void updatePlayerRating(int jerseyNumber, int newRating) { for (Player player : roster) { if (player.getJerseyNumber() ==…8. OOPS Theory #6 public class Car { public void horn() { System.out.println("Horn horn"); } } public class Ferrari extends Car { public void horn() { System.out.println("Ferarriiiiii"); } } public static void main(String[] args) { Ferrari ferrari = new Car(); ferrari.horn(); } Pick ONE option Horn horn Ferarriiii Cannot compile Runtime exception Clear Selection 9. OOPS Theory #7 In Java, we can achieve the abstraction by creating the blueprint of an object and only have abstract methods. What do we call this? Pick ONE option Interface Encapsulation Instance Protected Clear Selection
- public class Product { private String name; private double cost; public Product(String n, double c) { name=n; cost=c; } public String getName() { return name; } public double getCost() { return cost; What is the output of the code on the right? } public String toString() { return (name + "$" + cost); Shampoo $13.89 Shampoo $13.89 public static void addProducts (ArrayList c) { c.add(new Product("Shampoo", 13.89)); c.add(new Product("Bread",4.99)); c.add(new Product("Cereal",7.49)); } public static void main(String[] args) { ArrayList cart1 = new ArrayList(); addProducts(cart1); ArrayList cart2 = cart1; System.out.println(cart1.get(0)); System.out.println(cart2.get(0)); }Go off this code: public abstract class Employee{private String firstName;private String lastName;private String SSN;double salary; public Employee( String first, String last, String ssn ){firstName = first;lastName = last;SSN = ssn;} public void setfirstName( String first ){firstName = first; // should validate} public String getfirstName(){return firstName;} public void setlastName( String last ){lastName = last; // should validate} public String getlastName(){return lastName;} public void setSSN( String ssn ){this.SSN = ssn;}public String getSSN(){return SSN;} @Overridepublic String toString(){return String.format( "%-12s%-12s%-12s", getfirstName(), getlastName(), getSSN() );}public abstract double earnings();}Conver the class To UML diagram class Clint { private String accNumber; private String holderName; private long currBalance; public Clint() { currBalance = 0; } public Clint(String acc, String name, long bal) { accNumber = acc; holderName = name; currBalance = bal; } Scanner sc = new Scanner(System.in); // deposit money into the bank account by given amount amt public void deposit(long amt) { currBalance += amt; } // if amount is not given ask the user for the amount public void deposit() { System.out.print("Enter Amount(to deposit): $"); long amt = sc.nextLong(); currBalance += amt; } // withdraw money from the bank account public void withdraw(long amt) { if (currBalance >= amt) { currBalance -= amt; } else { System.out.println("Insufficient funds!"); } } // if amt is not given ask the user for the amount public…
- Subclass toString should call include super.toString(); re-submit these codes. public class Vehicle { private String registrationNumber; private String ownerName; private double price; private int yearManufactured; Vehicle [] myVehicles = new Vehicle[100]; public Vehicle() { registrationNumber=""; ownerName=""; price=0.0; yearManufactured=0; } public Vehicle(String registrationNumber, String ownerName, double price, int yearManufactured) { this.registrationNumber=registrationNumber; this.ownerName=ownerName; this.price=price; this.yearManufactured=yearManufactured; } public String getRegistrationNumber() { return registrationNumber; } public String getOwnerName() { return ownerName; } public double getPrice() { return price; } public int getYearManufactured() { return yearManufactured; }…class Lease{ private String name; private int aptNumber; private double rent; private int term; private static final int FEE = 10; public Lease(){ name = "XXX"; aptNumber = 0; rent = 1000; term = 12; } public void setName(String tenant) { name = tenant; } public void setAptNumber(int apt){ aptNumber = apt; } public void setRent(double monthRent) { rent = monthRent; } public void setTerm(int t){ term = t; } public String getName(){ return name; } public int getAptNumber(){ return aptNumber; } public double getRent(){ return rent; } public int getTerm(){ return term; } public void addPetFee(){ rent = rent + FEE; } } Create a class named TestLease as instructed below: Instantiate four Lease objects in the main()method. Change the aptNumber value for the first object to 20 Change the rent value…Public Class SavingsAccount { float interest; float FixedDeposit; SeniorAccount(float interest, float FixedDeposit) { this. interest = interest; this.fixedDeposit= FixedDeposit; } float calculateInterest(); { System.out.println(“Calculating Savings Account Interest”); return(FixedDeposit*interest/100); } } Public Class SeniorAccount extends SavingAccount { float seniorInterest; SeniorAccount(float interest, float FixedDeposit) { this.seniorInterest=interest; super(interest, FixedDeposit) } float calculateInterest() { System.out.println(“Calculating Savings Account Interest”); return(FixedDeposit*seniorinterest/10); } } Public static void main(String args[]) { SavingsAccount saving = new SavingsAccount(6,100000); System.out.println(saving.calculateinterest()); SeniorAccount senior=new seniorAccount(10,100000); System.out.println(Senior.calculateInterest()); } Correct the syntax and logical error
- Public Class SavingsAccount { float interest; float FixedDeposit; SeniorAccount(float interest, float FixedDeposit) { this. interest = interest; this.fixedDeposit= FixedDeposit; } float calculateInterest(); { System.out.println(“Calculating Savings Account Interest”); return(FixedDeposit*interest/100); } } Public Class SeniorAccount extends SavingAccount { float seniorInterest; SeniorAccount(float interest, float FixedDeposit) { this.seniorInterest=interest; super(interest, FixedDeposit) } float calculateInterest() { System.out.println(“Calculating Savings Account Interest”); return(FixedDeposit*seniorinterest/10); } } Public static void main(String args[]) { SavingsAccount saving = new SavingsAccount(6,100000); System.out.println(saving.calculateinterest()); SeniorAccount senior=new seniorAccount(10,100000); System.out.println(Senior.calculateInterest()); } Rubric: Correct the syntax and logical errors Proper working codepublic class FoodItem { private String name; private double fat; private double carbs; private double protein; // TODO: Define default constructor // TODO: Define second constructor with parameters to initialize private fields (name, fat, carbs, protein) public String getName() { return name; } public double getFat() { return fat; } public double getCarbs() { return carbs; } public double getProtein() { return protein; } public double getCalories(double numServings) { // Calorie formula double calories = ((fat * 9) + (carbs * 4) + (protein * 4)) * numServings; return calories; } public void printInfo() { System.out.println("Nutritional information per serving of " + name + ":"); System.out.printf(" Fat: %.2f g\n", fat); System.out.printf(" Carbohydrates: %.2f g\n", carbs); System.out.printf(" Protein: %.2f g\n", protein); }} import java.util.Scanner; public class NutritionalInfo {…interface StudentsADT{void admissions();void discharge();void transfers(); }public class Course{String cname;int cno;int credits;public Course(){System.out.println("\nDEFAULT constructor called");}public Course(String c){System.out.println("\noverloaded constructor called");cname=c;}public Course(Course ch){System.out.println("\nCopy constructor called");cname=ch;}void setCourseName(String ch){cname=ch;System.out.println("\n"+cname);}void setSelectionNumber(int cno1){cno=cno1;System.out.println("\n"+cno);}void setNumberOfCredits(int cdit){credits=cdit;System.out.println("\n"+credits);}void setLink(){System.out.println("\nset link");}String getCourseName(){System.out.println("\n"+cname);}int getSelectionNumber(){System.out.println("\n"+cno);}int getNumberOfCredits(){System.out.println("\n"+credits); }void getLink(){System.out.println("\ninside get link");}} public class Students{String sname;int cno;int credits;int maxno;public Students(){System.out.println("\nDEFAULT constructor…