Question Details

[answered] Assignment2 Due date: Thursday - November17th, 2016at 11:59


Please see the attachment for My question,,?

Thanks..


Assignment2 Due date: Thursday - November17th, 2016at 11:59 PM. Q1. Explain what each of the following two program segments computes:

 

1- int x = 2;

 

int y = x + x;

 

2- String s = "2";

 

String t = s + s;( .5 point ) Q2. Write the following mathematical expressions in Java.( .5 point ) Q3. What errors does this class have? How would you fix them? Rewrite the correct version

 

of this class.

 

public class Square {

 

private double sideLength;

 

private double area;

 

publicSquare(double sideLength) {

 

sideLength = sideLength;

 

}

 

public double getArea() {

 

area = sideLength * sideLength; returnarea;

 

}

 

public static void main(string args){

 

Square sq = new Square(4.4);

 

System.out.print("This Area of the square is:\t +sq. getArea);

 

( .5 point ) Q4. What is the order of execution of operators in the following equation?

 

a=99*5+4%2/6+(18-4)*2( .5 point ) Q5. Write a program called CheckPassFail which read the mark from user and prints "PASS"

 

if the mark is more than or equal to 60; or prints "FAIL" otherwise.

 

( 1pont ) Q6. Write a program that that computes the maximum of two numbers. You need to follow

 

the following instructions:

 

1. Create a class called ?MaxProgram?.

 

1. The class MaxProgram has only one methodcalled ?maxValue? . This

 

methodtakestwointegernumbers as parameters. The methodreturns the maximum

 

of the twonumbers, elseitreturns -1, If bothnumbers are equal.

 

1. To test this class, createanother class called ?Tester?, with a main method.

 

In the main method, create an object of the ?MaxProgram? class.

 

2. From the createdobject, call the ?maxValue? method, and giveitanytwonumbers.

 

3. Print the returned maximum number.

 

( 1 point ) Q7. A company applies a discount based on the price of the order. If the order is over $50,

 

the discount is 5%. If the order is over $100, the discount is 10%. Otherwise, there is no

 

discount. Write a sequence of if statements to get the discounted price of the order. (1

 

Point)

 


Solution details:
STATUS
Answered
QUALITY
Approved
ANSWER RATING

This question was answered on: Sep 18, 2020

PRICE: $15

Solution~0001005167.zip (25.37 KB)

Buy this answer for only: $15

This attachment is locked

We have a ready expert answer for this paper which you can use for in-depth understanding, research editing or paraphrasing. You can buy it or order for a fresh, original and plagiarism-free copy from our tutoring website www.aceyourhomework.com (Deadline assured. Flexible pricing. TurnItIn Report provided)

Pay using PayPal (No PayPal account Required) or your credit card . All your purchases are securely protected by .
SiteLock

About this Question

STATUS

Answered

QUALITY

Approved

DATE ANSWERED

Sep 18, 2020

EXPERT

Tutor

ANSWER RATING

GET INSTANT HELP/h4>

We have top-notch tutors who can do your essay/homework for you at a reasonable cost and then you can simply use that essay as a template to build your own arguments.

You can also use these solutions:

  • As a reference for in-depth understanding of the subject.
  • As a source of ideas / reasoning for your own research (if properly referenced)
  • For editing and paraphrasing (check your institution's definition of plagiarism and recommended paraphrase).
This we believe is a better way of understanding a problem and makes use of the efficiency of time of the student.

NEW ASSIGNMENT HELP?

Order New Solution. Quick Turnaround

Click on the button below in order to Order for a New, Original and High-Quality Essay Solutions. New orders are original solutions and precise to your writing instruction requirements. Place a New Order using the button below.

WE GUARANTEE, THAT YOUR PAPER WILL BE WRITTEN FROM SCRATCH AND WITHIN YOUR SET DEADLINE.

Order Now