1. public interface Carnivore { int pieces = 10; %3D public static void eatGrass(); public int chew() { return 13; } }
Q: Java
A: Given :- In the above question , the statement is mention in the above given question Need to…
Q: True or False. The below code correctly defines an interface: public interface MyFace { int numEyes…
A: Interface has an abstract method abstract method means only method declaration is there no method…
Q: An object is a(n) ______ of a class.
A: Given: An object is a(n) ______ of a class.
Q: class A{ public: class B{ public:
A: Answer: False
Q: In Java Know the correct syntax to write a Student class: fields name and grade ; constructors;…
A: Constructor definition: Constructor is a special method that contains the same name. The constructor…
Q: (java programing) I don't want it in handwriting. Define a student class. A student has the…
A: It is defined as programs can be asked from control statements, array, string, oops etc. Java basic…
Q: Create a RightTriangle class given the following design: RightTriangle variables: base, height…
A: Step 1:- Program Approach:- 1.Create the class RightTriangle 2.Date member are:- base height…
Q: public Plane () – this is the default constructor; it assigns the following initial values to the…
A: Plane class: package pp; import java.text.DecimalFormat; public class Plane { String airline;…
Q: Create a Calculator class that has following methods: sum, multiply, divide, modulus, sin, cos, tan…
A: GIVEN: Using java create class calculator.
Q: class gene { public: gene( ); gene(string n, string cl); string get_genename( ); //required the user…
A: Step 1:- Note:-I am solving this problem in the C++ programming language. Given :- Class gene {…
Q: Code: interface Bicycle{ //interface for bicycle void changeGear(int val); //abstract…
A: Solution is given below-
Q: JAVA CODING QUESTION. Object-oriented and constructor chaining!!! Build a "country" class. A…
A: A class named Country is created and it is assumed that already a class named Football_Stadium is…
Q: public Object equals(Object obj)
A: The correct answer of the questions is option "TRUE"
Q: (Object -oriented programing) 1. Here is Java code to create a chess piece: public class…
A: class ChessPiece { public String pieceName; public String position; public…
Q: Abstract methods are used when defining a) interface classes b) derived classes c) classes that have…
A: A) interface classes
Q: Define a Product class with attributes: String productName, double price. Include the following…
A: Find the required code in java given as below and sample output :
Q: Encapsulations accessor/mutator Method overloading Objects as parameters Objects as return type
A: Program Approach: In the given code two-class "Aeroplane and Airport" is declared that uses its…
Q: C# language Create a class for “Plane” having functionalities (methods) startengine(), fly() and…
A: Algorithm: 1. Start 2. Create a class Plane 3. Create two instance variables TTK and fuel inside…
Q: Design a "Vehicle" class. A vehicle assumes that the whole world is a 2-dimensional graph paper. It…
A: Vehicle class has a default constructor and along with that 4 more methods to move towards 4…
Q: Class: Square Create a class called "Square", which is inherited from “TwoDimensionShape”…
A: public abstract class TwoDimensionalShape { //creating abstract method which should be override by…
Q: The NET Framework has a class called that includes a number of methods for conducting sophisticated…
A: Given that: The NET Framework has a class called that includes a number of methods for conducting…
Q: T' is connected with the starting point of the side 'i+1' and the end-point of side 'n' is the…
A: We need to determine the number of vertices and then we need to allocate the memory , save the data…
Q: public interface Computable { double compute(double x); Write a statement that uses a lamb- da…
A: Given : public interface Computable{double compute(double x);}
Q: Course Title: Modern Programming Language Please Java Language Code Question : Design an abstract…
A: Circle.java public class Circle extends GeometricObject { private double radius; public Circle()…
Q: reference is used to refer to a child class object. class Main ( public static void main(String(]…
A: class Animal{ void displayInfo(){ System.out.println("Its A Animal"); }}class Dog…
Q: Design and implement a class called Car that contains instance data that represents the company,…
A: please do upvote for my efforts! Answer: Car Class code: import java.util.Date;public class Car {…
Q: Classes - Write a class to represent a AlternativeEnergyCar. Select the fields and methods that fit…
A: The complete code is given below with the output.
Q: java There is only one type of constructor and it is a constructor that does not take any…
A: Java Constructor are a methods that get invoked whenever we call the class for which the constructor…
Q: True or False An interface can contain only abstract methods and constants.
A: solution:True
Q: python Cylinder class: Instance variables: Make instance variables appropriately to accomplish the…
A: Python used to answer this question
Q: Write a class named Car that has the following fields: The yearModel field is an int that holds the…
A: Main.java import javax.swing.JOptionPane; public class Car { private int Speed = 0; private…
Q: A class object can encapsulate more than one
A: Data encapsulation is referred to the binding up of methods and members of the data. In…
Q: The class "Music" has the following attributes: name (String), composer (String). year (int),…
A: Explanation: The program has two classes, Music which holds the required attributes and another…
Q: 2. Complete the application below. public class CarApp { public static void main() { string color =…
A: ALGORITHM:- 1. Create a class CarApp with the variables defined in question. 2. Initialise a object…
Q: The statement: public final class Circle extends Shape implements Comparable indicates that: Select…
A: Given: 1) The statement: public final class Circle extends Shape implements Comparable<Circle>…
Q: Implement the design of the Author class so that the following output is produced:
A: Solution: Programming language used: Python Program Code in Python: (Note: all necessary comments…
Q: subject: object-oriented programming in your library there are two types of books. one category is…
A: Inheritance is an important feature of Object-Oriented Programming. It is the mechanism in java by…
Q: In java language on netbeans design a console application that will print the game sales for a…
A: Here I have created the class Games that implements the interface iGames. In this class, I have…
Q: Create an abstract class called GeometricFigure. Each figure includes a height, a width, a figure…
A: public class UseGeometric{ public static void main (String[] args) { Square s1=new…
Q: Design and implement a class called Car that contains instance data that represents the company,…
A: //CODE Car.java public class Car { private String model; private String Company; private…
Q: public class Person { // PLEASE START YOUR CODE HERE //…
A: Java. Code: public class Person{// PLEASE START YOUR CODE HERE//…
Q: Shape Classes Design classes Square, RightTriangle , and Triangle that encapsulate three geometric…
A: import java.io.Console; abstract class Shape{ char character; int rows; public…
Q: Bank Account Details
A: Java Code for class Account: //Super class accountpublic class Account{//all the variables with it's…
Q: /* (name header) */ public class BatteryTester { public static void main(String[] args) {…
A: public class BatteryTester{ public static void main(String[] args) {…
Q: True or False A class can implement more than one interface.
A: Class is a user-defined data type that encapsulates the data members and member functions. An…
Q: Object Oriented Programming in JAVA Define and use a class for the student record. The class…
A: Define the class Student for storing the student record. Create attributes for storing the quizzes,…
Q: The.NET Framework has a class called that includes a number of methods for conducting sophisticated…
A: Given that: The.NET Framework has a class called that includes a number of methods for conducting…
fix and remove errors
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
- public class Application { public static void main(String[] args) { Employee empl = new Employee(); empl.firstName = "Ali"; empl.lastName = "Omar"; empl.salary = 20000; Employee emp2 = new Employee(); emp2.firstName = "Mohamed"; emp2.lastName = "Nour"; emp2.salary = 30000; System.out.println("- System.out.printin("- empl.employeeSalary(); System.out.println("- empl.checkEmployeeSalary(emp1.salary, emp2.salary); System.out.printin("- System.out.println("- printEmployee(emp2); System.out.printin("- Employee employeeArr[] = new Employee[2]: employeeArr[0] = empl; employeeArr[1] = emp2; Application a = new Åpplication(); a.printArrayofEmployee(employeeArr); Non static (instance) start to call Static function to print ---------"); "); - Non Static function to print - --"); Non static (instance) start to call same class Static function to print --------); -"); Non Static function to print ----); System.out.println("- System.out.printin("- System.out.printin("Salary : " + Employee.salary);…public class LabProgram { public static void main(String args[]) { Course course = new Course(); String first; // first name String last; // last name double gpa; // grade point average first = "Henry"; last = "Cabot"; gpa = 3.5; course.addStudent(new Student(first, last, gpa)); // Add 1st student first = "Brenda"; last = "Stern"; gpa = 2.0; course.addStudent(new Student(first, last, gpa)); // Add 2nd student first = "Jane"; last = "Flynn"; gpa = 3.9; course.addStudent(new Student(first, last, gpa)); // Add 3rd student first = "Lynda"; last = "Robison"; gpa = 3.2; course.addStudent(new Student(first, last, gpa)); // Add 4th student course.printRoster(); } } // Class representing a student public class Student { private String first; // first name private String last; // last name private double gpa; // grade point average…Based on Figure 3, create a class named Child that inherits the Father class. Declare an instance name location (String) for class Child. [3 marks]
- Incorrect Question 6 public class Shape { Color fillColor; } public Shape() { fill Color = Color. RED; } } public Shape(Color fillColor) { this.fill Color = fillColor; } public class Circle extends Shape { int radius; public Circle() { radius = 1; } public Circle(int radius) { this.radius = radius; } public Circle(int radius, Color fillColor) { } super(fillColor); this.radius = radius; Circle c1= new Circle(); Circle c2= new Circle(5); Circle c3 = new Circle(10, Color.BLUE); Which of the following are correct? c2 has radius 5 c1 is red c2 is red c3 has radius 10 c3 has radius 1 c3 is red c1 is blue ✔c2 has radius 10 c3 is blue c1 has radius 5 c1 has radius 1 c2 has radius 1 c2 is blueinterface 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…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 code
- 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 errorWhat is outpout? public class Vehicle { public void drive(){ System.out.println("Driving vehicle"); } public class Plane extends Vehicle { @Override public void drive(){ System.out.println("Flying plane"); } public static void main(String args[]) { Vehicle myVehicle myVehicle.drive(); } } = new Plane(); syntax error Driving vehicle Flying plane Flying plane O Driving vehicle8. 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
- class Student { private int age = 18; public Student() { age = 19; } } public class Test { public static void main (String[] args){ Student s = new Student(); System.out.println (s.age); } }Class Quiz public Quiz (int quesList, int quesMissed) {quesList = this.quesList;quesMissed = this.quesMissed;} private void calculate(){// get the point worth of each question and calculate final scorepointsPerQues = (100/quesList);scoreQuiz = quesList - quesMissed;} Class PassFailQuiz public PassFailQuiz (int quesList, int quesMissed, int scoreQuiz) { super(quesList, quesMissed);} How do I move scoreQuiz from private void calculate() to equal the third constructor value in PassFailQuiz?package debugging; public class BeanCounter {public static int beanCount = 0;} public class Bean {public Color beanColor;public String description;public Bean(Color beanColor, String description){this.beanColor = beanColor;this.description = description;}} public class Color {double[] rgb;double saturation;public Color(double[] rgb, double saturation){this.rgb = rgb;this.saturation = 0.0;}} public class Debugging { /*** @param args the command line arguments*/public static void main(String[] args) {BeanCounter bc = new BeanCounter();double[] redGreenBlue = {22.3d, 41.7d, 202.57d};Color c = new Color(rgb, 22.44+0.05, 15.78, 79.53, 252.04);++BeanCounter.beanCount;Bean b = new FavaBean(c); // New bean created!bc.beanCount++;}} 1. Remove the errors, warnings and mistakes that are in the source code. 2. Modify the code so that: •one bean is created •one bean is counted •there is only one line in the main method