Question: Please, i need Unique answer, Use your own words (don't copy and paste). *Please, don't use handwriting. Given the code above: Find the errors (either

Please, i need Unique answer, Use your own words (don't copy and paste).

*Please, don't use handwriting.

Please, i need Unique answer, Use your own words (don't copy and

Given the code above:

  1. Find the errors (either compile or run-time error) so that you have the same output listed below then state the type of the error.

  1. After you fixed the errors, rewrite the Java code using your name.(Mohammed)

  1. Show a screenshot of the output (if there is no screenshot of the output, the student shall get a zero mark for this question).

paste). *Please, don't use handwriting. Given the code above: Find the errors

_______________________________________

Q2

Consider the following java application consisting of two classes, and then answer the questions below.

(either compile or run-time error) so that you have the same output

listed below then state the type of the error. After you fixed

  1. Find and fix the errors in the previous application.
  2. What is the output of the previous application? (What will be printed on the console window when CarTester class is executed)?
  3. What are the values of (model) and (year) variables for the object variable car1 and why?

_______________

Q3

Write a program that asks the user to enter two integers and then print:

The sum

The difference

The product

The average

The maximum (the larger of the two)

The minimum (the smaller of the two)

Hint: The max and min functions are declared in the Math class.

_________________________

Q4

  1. Create a class "Mobile" with the following specifications: brand, color, screen size and camera size as field.
  2. Declare the instance variableswith suitable data types.
  3. Define a constructor that allow the initialization of all the data of a mobileby specific values.
  4. Define all the needed getter methods: getBrand(), getColor(), getScreen() and getCamera().
  5. Write a tester class. In the main, create twophones then, display the details of each one.

public class Students public static void main (String args) String s1"Java Programming" String s2"at seu" String s3- "Type your ne "; System.out.print (S1) System.out.print("" System.out.println (s2.toupperCase)) System.out.println (s3) System.out.println( "This is my first Assignment" System.out.print (s1.replace ("java""cs140")) System.out.print("" System.out.println (s2.toLowerCase)) System.out.print (8 8) System.out.print (" = "); System.out.println (s1.length(5)) Output -Students (run) run: Java Programming AT SEU My name is Mohammed F. Ali! n This is my first Assignment CS140 Programming at seu 8+8e 16 Error number Error Type 1 System.out.print(S1), Compile-time error 4 Class1: public class Car( private string modeli privateat year; publig Car ) model= "" year, = 0; publis Car (String model, int year) this.mode = model; this, year = year; public tring shangeModel (String model) this . mode model; = string getModel return model: public J. public void changeYear (int year) t this.ye a r = year; publicintgetYear) yeas Class2: publig class CarTester publis static void main (String[] args) Car car1 = new Car ("Toyota", 2017); System.outaprintln(car1.getModel )) System.outaprintln(car1.getYear)) Car car2 = car 1 ; car2.Model ("Nissan" car2.changeYear (1999); System.outaprintln(car2.getModel )) System.out println(car2.Year ))

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!