Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

image text in transcribed

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 (My name is Omar)
  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).

image text in transcribed

_______________________________________

Q2

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

image text in transcribed

image text in transcribed

  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 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_step_2

Step: 3

blur-text-image_step3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DB2 11 The Ultimate Database For Cloud Analytics And Mobile

Authors: John Campbell, Chris Crone, Gareth Jones, Surekha Parekh, Jay Yothers

1st Edition

ISBN: 1583474013, 978-1583474013

More Books

Students also viewed these Databases questions

Question

Explain basic guidelines for effective multicultural communication.

Answered: 1 week ago

Question

Identify communication barriers and describe ways to remove them.

Answered: 1 week ago

Question

Explain the communication process.

Answered: 1 week ago