2. Determine the output for the folwing code. Box in your final output result. public class Greek int i-l; public int getI() System.out.print("Super"); return i; public atatic void main (String args (1) Greek ga-new Arabik (; System.out.print (ga.i+" +ga.getI()) : public class Arabik extends Greek int i-2; public int getI() System.out.print ("Sub"); return i;
Q: public abstract class DebugBoat { String boatType = new String(); int passengers String…
A: public abstract class DebugBoat{ String boatType = new String(); int passengers; String power…
Q: Consider the below code and choose the correct output. public class Main { public int a; public long…
A: The program is written in Java. Check the program screenshot for the correct indentation. Please…
Q: Step 1) Copy the following code into an Editor public class Test{ public static void main(String a…
A: The step-by-step complete code is given below, with proper explanations.
Q: (this is question1) public abstract class Shape { public Shape() { } public abstract…
A: Here we have an abstract class shape that has an abstract method and one method that returns the…
Q: design a set of classes and methods that could take an input string with a mathematical expression…
A: Python program to evaluate mathematical expression
Q: Given the following class: public class Greetings { public void writeGreeting (String str) {…
A: In the class "showGreeting", the object "gt" should be initialized. Otherwise it shows the error.…
Q: (Java) 7.2 Code: Look at the following Person.java class code: class Person{ public String name;…
A: The toString() method is a method in java that is used to print or output the values of an object or…
Q: Assume that you are applying “testing” and “inspection”, the two defect finding methods in the…
A: The answer is as follows.
Q: 3. a Given the following code: public class Test { public static void main (String [] args) { Object…
A: ********************** Explaination of the code ************************* In the first part and in…
Q: Use the class provided, TestOverloadCall printMax to print the highest of 33 and 89Call printMax to…
A: Program:public class TestOverload{ public static void main(String[] args) {…
Q: Dry run the below programs and explain the reasons of output. If there is any error then correct…
A: EXPLANATION class access{ public int x; static int y; // all static variables are common for all…
Q: Evaluate the JAVA code snippet below, then motivate why this is representative of good programming…
A: Good programming practices: The given code snippet is not an example of good programming practice…
Q: This is a debugging question - The files provided in the code editor to the right contain syntax…
A: The correct code is: // DebugEleven1.java abstract class DebugBoat{ String boatType = new…
Q: public abstract class DebugBoat { String boatType = new String(); int passengers String…
A: public abstract class DebugBoat{ String boatType = new String(); int passengers; String power…
Q: For the given code below, which lines are valid (will compile and run)? Assume each line is run…
A: The problem is based on the basics of static and non-static functions in java programming language.
Q: //The program below doesn't compile, what is the problem? public class Test { public static void…
A: Your error is " multiple non-overriding abstract methods found in interface T " So, remove the…
Q: Define a constructor as indicated. Sample output for below program: Year: 0, VIN: -1 Year: 2009,…
A: PROGRAM: // ===== Code from file CarRecord.java ===== public class CarRecord { private int yearMade;…
Q: VII Show what is printed by the following program and the work space with the values of the…
A: PROGRAM CODE: public class Main{ public static int funny (int t, int v) {int w;if (t + 1 >…
Q: For the given code below, which lines are valid (will compile and run)? Assume each line is run…
A: Your answer is given below as you required .
Q: public abstract class DebugBoat { String boatType = new String(); int passengers; String…
A: public abstract class DebugBoat{ String boatType = new String(); int passengers; String power…
Q: 2. Consider the following class definitions: public class BClass private int x; public void set(int…
A: Lets see the solution in the next steps
Q: Identify the user-defined method based on the program given below. public class Mark int mark1,…
A: The answer is as follows:-
Q: What is the result of running this code. As always, explaining what is happening allows me to give…
A: There is one java program given, public class HelloWorld{ public static void main(String…
Q: 2. What is output of executing the following class? public class Test { int x; static int y; public…
A: An instance variable declared as static is essentially a global variable. When objects of its class…
Q: Question public class MyProgram ( public static void main(String[] args) { int h=10, t-22;…
A: Answer the above question are as follows:
Q: Consider the following classes: public class Top{ int x; public Top (int x){ this.x = x + 1; } }…
A: The solution to the give java program is given below.
Q: o Page 200, Question 5.25(25%) • Modify the application you wrote in Exercise 5.24 to read an odd…
A: According to information given:- We have to modify the code to read an odd number in range of 1-19…
Q: Here is the code given: public class Billing { final static double TAX = 0.08; public static void…
A: Case 1: computeBill() receives a single parameter, it represents the price of one book ordered. Add…
Q: 1. What will be the output of the code below? class Animal ( void walk() ( 3 220 | INTEGRATIVE…
A: The output of the above code are:
Q: Task 3 Implement the design of the Passenger class so that the following output is produced: The…
A: Given:
Q: Write a second constructor as indicated. Sample output: User1: Minutes: 0, Messages: 0 User2:…
A: Program //PhonePlan.java public class PhonePlan { private int freeMinutes; private int…
Q: The files provided in the code editor to the right contain syntax and/or logic errors. In each case,…
A: we need to determine and fix the problem, remove all syntax and coding errors, and run the program…
Q: Analyze the code below and answer the questions that follows. class Shapes { public void identify ()…
A: OOP stands for Object Oriented Programming.
Q: This is a debugging question - The files provided in the code editor to the right contain syntax…
A: The debug code is: // DebugEleven2.java abstract class DebugBoat{ String boatType = new String();…
Q: 2. Will the code compile? If yes, determine the output. If no, state why. class Pet { public Pet(int…
A: Qa constructor is a special method in java which contains same name as of class name. It dont…
Q: Debug this program to create the desired result attached in the picture. public class Library { //…
A: Here I have defined a static class named Book with one data member and constructor inside the class…
Q: Consider the following classes. What is output when then DogApp program is executed? public class…
A: The given program: Program execution for the given program is shown below.
Q: Consider the following code snippet. How many times do you expect "In the constructor!" to be…
A: Please find the answer below:
Q: Read the following code and select the correct output. Linel: public class Foo { public void…
A: Please give positive ratings for my efforts. Thanks. ANSWER Here, according to the given…
Q: Problem 4) Suppose the following Course class is given: public class Course { private String…
A: If the evaluation of a logical expression exits even before the complete evaluation is done, it is…
Q: What is the output of executing the following code? public class Test { public static void…
A: JAVA CODE:- public class Main {public static void main(String[] args) {m(new…
Q: Select the correct output of the given code below: public class Person{ public void talk () {…
A: public class Person{ public void talk(){ System.out.println("I am a Person");} } public…
Q: Please help me with these errors in java. Errors below public class Student { //student related…
A: Modified code: import java.util.Scanner;import java.sql.*; class Student { String studName;…
Q: Trace through the following program and Show the Ol public class Employee { private static int empID…
A: public class Employee{ private static int empID = 11111; private String name, position;…
Q: Given the following class definition class a { private: int x; char ch; public: double y;…
A: For declaring object of above class, constructor needs: 1st argument of type 'int' compulsory 2nd…
Q: In the following code, where do you find overloading and where do you find overriding? Why? public…
A: Overriding: The definition of method overriding includes some points- Override methods are…
Q: What is the output of the following code: public class A public int methodOfA(int i) { i+= 10;…
A: Inheritance: In this one class use the methods of other calss Base class extends the methods of the…
Q: Q4) Write the output of the following code segment public class CarStatic { public static void main…
A: In the above program, getInfo() is non static method. But we call that method using Class name.
Q: 3. Consider the following two classes and write down the output of the following code: abstract…
A: Given data, Consider the following two classes and write down the output of the following code:…
Q: 2. What is the output of executing the following code after correcting errors if any? public class…
A: public class Test{public static void main(String[] args) {m(new GraduateStudent());m(new…
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
- Please help debug this: Debugging Exercise 4-3, Farrell, Joyce, Java Programming, 9th edition, Cengage Learning public class DebugBox { private int width; private int length; private int height; private FixDebugBox() { length = 1; width = 1; height = 1; } public DebugBox(int width, int length, int height) { width = width; length = length; height = height; } public void showData() { System.out.println("Width: " + width + " Length: " + length + " Height: " + height); } public double getVolume() { double vol = length - width - height; return vol; } }Please solve this using java and attach output screenshot and implementation screenshot. Using this clock class please: public class Clock { private int hr; private int min; private int sec; public Clock() { setTime(0, 0, 0); } public Clock(int hours, int minutes, int seconds) { setTime(hours, minutes, seconds); } public void setTime(int hours, int minutes, int seconds) { if (0 <= hours && hours < 24) hr = hours; else hr = 0; if (0 <= minutes && minutes < 60) min = minutes; else min = 0; if(0 <= seconds && seconds < 60) sec = seconds; else sec = 0; } public int getHours() { return hr; } public int getMinutes() { return min; } public int getSeconds() { return sec; } public void printTime() { if (hr < 10) System.out.print("0"); System.out.print(hr + ":"); if (min < 10) System.out.print("0"); System.out.print(min + ":"); if (sec < 10) System.out.print("0"); System.out.print(sec); } public void incrementSeconds() { sec++; if (sec >…Define a constructor as indicated. Sample output for below program: Year: 0, VIN: -1 Year: 2009, VIN: 444555666 // ===== Code from file CarRecord.java =====public class CarRecord {private int yearMade;private int vehicleIdNum; // FIXME: Write constructor, initialize year to 0, vehicle ID num to -1. /* Your solution goes here */ public void setYearMade(int originalYear) {yearMade = originalYear;} public void setVehicleIdNum(int vehIdNum) {vehicleIdNum = vehIdNum;} public void print() {System.out.println("Year: " + yearMade + ", VIN: " + vehicleIdNum);}}// ===== end ===== // ===== Code from file CallCarRecord.java =====public class CallCarRecord {public static void main(String [] args) {CarRecord familyCar = new CarRecord(); familyCar.print();familyCar.setYearMade(2009);familyCar.setVehicleIdNum(444555666);familyCar.print(); }}// ===== end =====
- JAVA Determine the output for the following code public class Beta extends Baap { public int h = 44; public int getH( ) { System.out.println("Beta " + h); return h; } public static void main(String[ ] args) { Baap b = new Beta(); System.out.println(b.h + " " + b.getH( )); Beta bb = (Beta) b; System.out.println(bb.h + " " + bb.getH( )); } } public class Baap { public int h = 4; public int getH( ) { System.out.println("Baap " + h); return h; } }Given the following class definition,public class Pen{ private String name; public Pen(String n) { name = n; } @Override public String toString() { return this.name + "-"; }}public class Brush extends Pen{ private int ink; public Brush(String n, int m) { super(n); ink = m; } @Override public String toString() { return super.toString() + this.ink + "-"; }}What is the output of the following program? Brush fluffy = new Brush("Fluffy", 5); System.out.print(fluffy);If there is no output, please specify "nothing" (no quotes) in the blank for the output. No hand written and fast answer with explanationWrite a unit test for addInventory(), which has an error. Call redSweater.addInventory() with parameter sweaterShipment. Print the shown error if the subsequent quantity is incorrect. Sample output for failed unit test given initial quantity is 10 and sweaterShipment is 50: Beginning tests. UNIT TEST FAILED: addInventory() Tests complete. // ===== Code from file InventoryTag.java =====public class InventoryTag {private int quantityRemaining; public InventoryTag() {quantityRemaining = 0;} public int getQuantityRemaining() {return quantityRemaining;} public void addInventory(int numItems) {if (numItems > 10) {quantityRemaining = quantityRemaining + numItems;}}}// ===== end ===== // ===== Code from file CallInventoryTag.java =====import java.util.Scanner; public class CallInventoryTag {public static void main(String [] args) {Scanner scnr = new Scanner(System.in);InventoryTag redSweater = new InventoryTag();int sweaterShipment;int sweaterInventoryBefore; sweaterInventoryBefore =…
- COMPLETE THE JAVA CODE BELOWSEE ATTACHED PHOTO FOR THE PROBLEM AND THE OUTPUT class Employee extends Person { private String companyName; public Employee(String name,String address,int age,String companyName) { super(name,address,age); this.companyName = companyName; } public Employee() { } public void setCompanyName(String cname){ companyName = cname; } public String getCompanyName(){ return companyName; } // Override the display method in the Person class // define earnings as an abstract method with a return type of double // override the toString() and equals() methods } class HourlyEmployee extends Employee{ private int hoursWorked; //total number of hours worked private double rate; // rate per hour public HourlyEmployee(String name,String address,int age,String cName,int hoursWorked,double rate) { } public HourlyEmployee(String name,String address,int age,String cName)…Solve below java problem please. You are given a list of Employee objects and you need to implement a method that returns the top n highest-paid employees. class Employee { private String name; private double salary; public Employee(String name, double salary) { this.name = name; this.salary = salary; } public String getName() { return name; } public double getSalary() { return salary; } }Given the following class. (JAVA) public class FamilyMember { public String drink( ) {return “cup”;} public String eat( ) {return “fork”;} } Write a Baby class that is derived from the FamilyMember class. The Baby class has an instance variable for the age, a default constructor, and a constructor that accepts an integer. Include any other necessary methods. If a baby is older than 3 years, print that “it eats with its fork”; otherwise, “it eats with its hands”.
- The following is in Java: public class MyClass { private int x; private double y; public static void setValues(int a, double b) { x = a; y = b; } } 1) What is the problem? 2) In a few sentences how can the issue be fixed?What is the output of the following code? Explain each line of the console output in yourown words. (HINT: if there are errors, please explain why the errors occur)import java.util.ArrayList;public class Pet {public void goToVet(){System.out.println("My Pet needs to go to Vet ...");}public static void main(String args[]){Hamster pug = new Hamster();Pet sally = new Pet();Pet loki = new Hamster();Object sunny = new Object();Object joy = new Pet();Object mini = new Hamster();ArrayList<Object> myList = new ArrayList<>(); myList.add(pug); myList.add(sally);myList.add(loki);myList.add(sunny);myList.add(joy);myList.add(mini);myList.forEach(i -> {if (i instanceof Hamster) {System.out.println("My Pet is cute: so " + (((Hamster) i).cute())+ "! ");((Hamster) i).goToVet();}else if (i instanceof Pet)((Pet) i).goToVet();elseSystem.out.println("This is not a Pet");});}}class Hamster extends Pet {public void goToVet(){System.out.println("My Hamster needs to go to Vet…What is the output of the following code? Explain each line of the console output in yourown words. (HINT: if there are errors, please explain why the errors occur) import java.util.ArrayList;public class Pet {public void goToVet(){System.out.println("My Pet needs to go to Vet ...");}public static void main(String args[]){Hamster pug = new Hamster();Pet sally = new Pet();Pet loki = new Hamster();Object sunny = new Object();Object joy = new Pet();Object mini = new Hamster();ArrayList<Object> myList = new ArrayList<>(); myList.add(pug); myList.add(sally);myList.add(loki);myList.add(sunny);myList.add(joy);myList.add(mini);myList.forEach(i -> {if (i instanceof Hamster) {System.out.println("My Pet is cute: so " + (((Hamster) i).cute())+ "! ");((Hamster) i).goToVet();}else if (i instanceof Pet)((Pet) i).goToVet();elseSystem.out.println("This is not a Pet");});}}class Hamster extends Pet {public void goToVet(){System.out.println("My Hamster needs to go to Vet…