Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java Programming Part I: Code a Rectangle class that has the following fields: width : double Height: double The class should have the following methods:

Java Programming

image text in transcribedimage text in transcribed

Part I: Code a Rectangle class that has the following fields: width : double Height: double The class should have the following methods: Constructor: Accepts the width and height of the rectangle as arguments. setWidth and setHeight: Mutator methods for setting these two fields. getWidth and getHeight: A accessor method for returning the radius field. compputeCircumference Computes the circumference of the rectangle and returns it. computeArea: Computes the area of the rectangle returns it. area = width * height Then code a testing class (driver class) RectangleApp that tests the Rectangle class, by asking the user to enter the width and height of a rectangle, creating an object and call its methods to pass the input data, displaying the values of 'input data and computed results, respectively. Coding Requirements: Must use required/meaningful names for fields, variables, methods and classes. Must document each of your source code (see example in the next slide) Must separate operation class Rectangle from the driver class RectangleApp. Part II: Design a RomanNumerals class that takes a number within 1 to 10, convert and display it to the roman numeral version of that number (I, II, III, IV, V ... X). If the number entered by user is outside the range of 1-10, the program should display an error message. Code a driver class RomanNumeralsApp to test the class by asking user to enter a number, creating an object of RomanNumerals and calling its methods getNumber, setNumber, convertNum and displayResult to perform the described task. > Coding Requirements: Must use required/meaningful names for fields, variables, methods and classes. Must document each of your source code (see example in the next slide) Must separate operation class RomanNumerals from the driver class Roman NumeralsApp. Part III (Optional for extra-credit): The exercises you have completed from Chapter 1 to 4 including all even-numbered M/C and TIF questions, all even-numbered Predict Output, and all even-numbered Algorithm Workbench in these 4 chapters using any text editor

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

Graph Databases

Authors: Ian Robinson, Jim Webber, Emil Eifrem

1st Edition

1449356265, 978-1449356262

More Books

Students also viewed these Databases questions