Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assignment-3 Object Oriented Programming- Java | Weightage - 3% Y axis (2,2) (6,4) (0, 0) X axis Note - This assignment contains several parts

image text in transcribedimage text in transcribed

Assignment-3 Object Oriented Programming- Java | Weightage - 3% Y axis (2,2) (6,4) (0, 0) X axis Note - This assignment contains several parts i.e. creating programs and testing it. All parts are compulsory. All labs/assignments are individual assignments unless specified by the instructor and must be completed individually by all students; please refer to the Academic Honesty document located at;- https://caps.sheridancollege.ca/student- guide/academic-policies-and-procedures.aspx There are three questions. Part 1: Verify point is inside a rectangle Write a program that prompts the user to enter a point (x, y) and checks whether the point is within the rectangle centered at (0, 0) with width 10 and height 5. For example, (2, 2) is inside the rectangle and (6, 4) is outside the rectangle, as shown in the Figure. (Hint: A point is in the rectangle if its horizontal distance to (0, 0) is less than or equal to 10/2 and its vertical distance to (0, 0) is less than or equal to 5/2.) Here are sample runs of the program: Sample 1: Enter a point with two coordinates: 22 Point (2.0, 2.0) is in the rectangle Sample 2: Enter a point with two coordinates: 6 4 Point (6.0, 4.0) is not in the rectangle Part 2: Proper Fractions, Improper Fractions, and Mixed Fractions Proper fractions, improper fractions, and mixed fractions are defined at http://www.ltcconline.net/greenl/courses/187/b/impropermixed.htm. Write a program that prompts the user to enter the numerator and denominator of a fraction number and determines whether it is a proper fraction and improper fraction. For an improper fraction number, display its mixed fraction in the form of a + b/c if b % c is not zero; otherwise, display only the integer. Here are sample runs of the program: Sample 1: Enter a numerator: 16 Enter a denominator: 3 163 is an improper fraction and its mixed fraction is 5 + 1 / 3. Sample 2: Enter a numerator: 6 Enter a denominator: 7 67 is a proper fraction Sample 3: Enter a numerator: 6 Enter a denominator: 2 62 is an improper fraction and it can be reduced to 3 Part 3: Compute Sales and Compute Commission Write the Java program that will compute sales commissions. The following scheme is used to determine the commission rate. $5001 to 10,000 10,001 and above 10% 12% Your program reads the sales amount from the keyboard and displays the result on the console. C:\WINNT\System32\cmd.exe Enter sales amount 15000 the commission is 1500.0 for sales amount of 15000.0 Press any key to continue Rewrite another Java program using to compute the sales amount if the user enters the sales commissions from the keyboard. Output of this program is given below: Output of the program: Enter the sales Commission 1500 The sales amount $15000 is need to make a commission of $1500 Please verify your results with the input given here. Program must be fully commented (using three styles of Java comments). End of document Sales Amount $1 to $5000 Commission rate 8%

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

blur-text-image

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

Mobile Communications

Authors: Jochen Schiller

2nd edition

978-0321123817, 321123816, 978-8131724262

More Books

Students also viewed these Programming questions