Write a java program that prints rectangles

Assignment Help Other Subject
Reference no: EM132271202

Description:

Write a Java program that inputs an unspecified number of integers from the user. The program should calculate the following statistics:

• The total of all the numbers
• The average (mean) of all the numbers (displayed as a floating-point value)
• The number of positive values
• The number of negative values
• The highest number entered
• The lowest number entered

The end of the input is indicated by the value 999, which does not count as one of the numbers. This is known as a sentinel value. When all the numbers have been processed the statistics should be printed out, for example

Enter one or more integers (0 marks the end of input): 1 2 -1 3 999
The total is 5
The average is 1.25
The number of positives is 3 The number of negatives is 1 The highest number is 3
The lowest number is -1

The program should work with any number of input values. Assume that the user always types integer values, no need to properly handle wrong input. Program should not have any unnecessary duplicated code.

Hints:
• To calculate the average you'll need to keep track of how many numbers were entered
• To determine the highest or lowest number your program will need to keep track of the highest/lowest number seen so far

Part B

Write a Java program that prints rectangles of three different sizes to the screen, with a blank line between each rectangle.
• A 5 x 3 rectangle made of the letter ‘O'
• A 16 x 6 rectangle made of the letter ‘T'
• A 2 x 4 rectangle made of the left square bracket ‘%'

In the dimensions given above the first number is the horizontal width and the second number is the vertical height of the rectangle. Here is what your output should look like. Your program should be written in a flexible, general way so that the rectangle dimensions and the letter/character used to print each rectangle can be changed easily without rewriting the whole program.

Your program must have a class called RectangleMaker to do most of the work. The class RectangleMaker should have

1. Private fields that define:
a. The dimensions of the rectangle (width & height)
b. The character used to print the rectangle
2. Mutator methods (setters) to set the fields.
3. A print() method to print the rectangle.
4. Optional accessor methods (getters), not necessary.
5. The main() method that creates three objects (instances) of class RectangleMaker and call the print() methods. As usual keep your program efficient and try to minimize the amount of duplicated code.

Important: You should not use 'static' variables or methods except for the main() method declaration itself. Use one class that creates objects of its own type in the main() method.

Attachment:- Assignment.rar

Reference no: EM132271202

Questions Cloud

How would you characterize ubers business model : How would you characterize Uber's business model and strategy? What are the key elements of its customer value proposition? Its profit formula?
Close-knit work arrangement deal with issues that arise : How could a Gen Y employee and an older more experienced employee that are paired together in such a close-knit work arrangement deal with issues that arise?
Did they provide enough evidence to adequately establish : What evidence was presented? Was it adequate to establish a causal link? Did the evidence presented come from credible and reliable sources?
How compensation plans influence success of an organization : How compensation plans can influence the success of an organization. How influences outside an organization can affect its compensation plan.
Write a java program that prints rectangles : PROG10082 - Object Oriented Programming - Sheridan college - Write a Java program that inputs an unspecified number of integers from the user
Why was the given piece of legislation proposed : Enacted Legislation Paper instructions!!! Need help with 700-1050 word paper! Why was this piece of legislation proposed? Summarize the purpose of the act.
What is your perception of free trade : What is your perception of free trade? Think about the advantages of free trade; what are two benefits that result from free trade?
Multinational managers encounter many levels of culture : Multinational managers encounter many levels of culture. Which of the culture levels do you think might be the most difficult to manage?
Transitioning to a multinational corporation : If you were a mid-level manager in a company that was transitioning to a multinational corporation, what would your main concerns (as a manager)

Reviews

len2271202

3/31/2019 10:27:07 PM

Your submission will be evaluated based on the following criteria: Efficient Code: Program doesn’t use too much repetitive code (e.g. uses methods instead of copy/pasting code). Program uses variables where and only when necessary; program doesn't define variables that are never used, nor does it use too many variables for unnecessary tasks; program logic is written concisely and is not cluttered with unnecessary tasks. Functionality: Program functions according to specifications. Programming Style: Proper indentation and spacing; use of comments; coding conventions regarding variable/method/class names followed. Part B: Good organization and clarity of written communication. Other: All instructions regarding submissions and program specifications have been followed; submission was completed and submitted as requested in a timely fashion; techniques discussed in class have been used.

len2271202

3/31/2019 10:27:00 PM

i want this assignment by tomorrow 5 pm so no delay please (10 marks) Your submission must follow all the submission requirements outlined below. Submit your assignment (.java files ONLY) using SLATE into A3 dropbox. Submit a text file (.txt) of the output using the “Add a File” button for each part. Do not submit in any other types of files like .class or .java~. Files with names ending .java~ are backup files and should not be handed in. To save the output of your program right-click on the Dr. Java “Interactions” window and choose Save Copy of Interactions. Your assignment must be submitted before 11:59 pm on the due date. Any assignments submitted after this time are considered late and will be subject to rules governing late assignments.

Write a Review

Other Subject Questions & Answers

  Identify the project management methodology used

Identify the project management methodology used in the case and explain the characteristics of the project that indicate the methodology.

  Draw men on the left and women on the right

Draw men on the left and women on the right. Use appropriate symbols for marriage, divorce, unmarried couples, adoptions, etc.

  What is worldview

What is worldview? Reflecting on the example of the Zanaki people in the Hesselgrave article (Article 68)

  Sandra lives in the pacific northwest

Sandra lives in the Pacific Northwest and enjoys walking to and from work during sunny days.

  Why should we use evidence-based practice

Choose one evidence-based practice that you see yourself using as a provider in your clinical practice and discuss how it meets the listed benefits.

  The war on terrorism represent a break

To what extent does the War on Terrorism represent a break with previous United States foreign and defense policy?

  Development of any proposed improvement strategies

ICT709 ICT Industry Project - Development of WK Ashman web-based secure client interaction space - client collaboration space will utilise customised variants

  Discuss about the public health program evaluation

In public health program evaluation, there are many essential components and contributions relating to evaluation, such as using the logic model to understand.

  Evaluate the effectiveness of the communication of geicos

write a five to seven 5-7 page paper in which you1. determine which facets of the geico total rewards program align

  Discuss the concept that slaves are better off with masters

Discuss the concept that slaves are better off with their masters than they would be on their own

  What sorts of issues are most pressing in the case study

Under the Christian narrative and Christian vision, what sorts of issues are most pressing in this case study? Should the physician allow Mike to continue.

  The boeing 757-200 er airliner carries 200 passenger and

the boeing 757-200 er airliner carries 200 passenger and has doors with a height of 72 in. .heights of men are normally

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd