Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Do fan and testfan Design a class named Fan to represent a fan. The class contains: Three constants named SLOW, MEDIUM, and FAST with the

image text in transcribedDo fan and testfanimage text in transcribed

Design a class named Fan to represent a fan. The class contains: Three constants named SLOW, MEDIUM, and FAST with the values 1, 2. and 3 to denote the fun speed. A private into data field named speed that specifies the speed of the fan (the default is SLOW). A private boolean data field named on that specifies whether the fan is on (the default is false). A private double data field named radius that specifies the radius of the fan (the default is 5). A string data field named col or that specifies the color of the fan (the default is blue). The accessor and mutator methods for all four data fields. A no-are constructor that creates a default fan. A method named toString() that returns a string description for the fan. If the fan is on, the method returns the fan speed, color, and radius in one combined string. If the fan is not on. the method returns the fan color and radius along with the string "fan is off' in one combined string. Draw the UML diagram for the class and then implement the class. Write a test program that creates two Fan objects. Assign maximum speed, radius 10. color yellow. and turn it on to the first object. Assign medium speed, radius S, color blue, and turn i(off to the second object. Display the objects by invoking their toString method. (Geometry: n-sided regular polygon) In an n-sided regular polygon, all sides have the same length and all angles have the same degree (i.e., the polygon is both equilateral and equiangular). Design a class named Regu larPolygon that contains: A private int data field named n that defines the number of sides in the polygon with default value 3. A private double data field named side that stores the length of the side with default value 1. A private double data field named x that defines the x-coordinate of the polygon's center with default value 0. Use JGrasp to design and implement the following programs (from the end of Chapter 9 in the textbook) and understand what they do. Required; Use java assert statement to validate program input values when conditions applied to inputs (for int and char types). See Chapter 3 slides for code examples. Apply this requirement to both lab exercises and assignment programs. Following the instructions in the problem statement, design and implement a Java program for programming exercise 9.8, page 362 (called Fan). Next, develop a test program in a separate file (call it Teszsan) to create two Fan objects and test the class methods on these objects following the instructions stated in the problem statement. Document your code, and organize and space the outputs properly. Use escape characters and formatting objects when applicable. Design and implement a Java class (name it SunroerStats. java) that tracks statistics for summer job salaries for a group of people over several years. The only data field you need is a 2-Dimenssional array of values representing salaries. The rows the represents the people and the columns represent the years. The constructor method takes two integers representing the number of people and the number of years, then randomly generates the annual salaries and fills the array. Other class methods include the following: - A method to return the index of the person having made the most money over the years. A method to return the index of the year when the highest salary was earned. A method to return the total amount of money made by a person (specified row index). A method to return the total amount of money made by all the people over the years. A method to return the index of the person who made the highest salary in a given year (specified by

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_2

Step: 3

blur-text-image_3

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

Professional Microsoft SQL Server 2014 Integration Services

Authors: Brian Knight, Devin Knight

1st Edition

1118850904, 9781118850909

More Books

Students also viewed these Databases questions

Question

l Write a job description and the job specifications for it.

Answered: 1 week ago

Question

What is the basis for Security Concerns in Cloud Computing?

Answered: 1 week ago

Question

Describe the three main Cloud Computing Environments.

Answered: 1 week ago