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

  Cross-cultural opportunities and conflicts in canada

Short Paper on Cross-cultural Opportunities and Conflicts in Canada.

  Sociology theory questions

Sociology are very fundamental in nature. Role strain and role constraint speak about the duties and responsibilities of the roles of people in society or in a group. A short theory about Darwin and Moths is also answered.

  A book review on unfaithful angels

This review will help the reader understand the social work profession through different concepts giving the glimpse of why the social work profession might have drifted away from its original purpose of serving the poor.

  Disorder paper: schizophrenia

Schizophrenia does not really have just one single cause. It is a possibility that this disorder could be inherited but not all doctors are sure.

  Individual assignment: two models handout and rubric

Individual Assignment : Two Models Handout and Rubric,    This paper will allow you to understand and evaluate two vastly different organizational models and to effectively communicate their differences.

  Developing strategic intent for toyota

The following report includes the description about the organization, its strategies, industry analysis in which it operates and its position in the industry.

  Gasoline powered passenger vehicles

In this study, we examine how gasoline price volatility and income of the consumers impacts consumer's demand for gasoline.

  An aspect of poverty in canada

Economics thesis undergrad 4th year paper to write. it should be about 22 pages in length, literature review, economic analysis and then data or cost benefit analysis.

  Ngn customer satisfaction qos indicator for 3g services

The paper aims to highlight the global trends in countries and regions where 3G has already been introduced and propose an implementation plan to the telecom operators of developing countries.

  Prepare a power point presentation

Prepare the power point presentation for the case: Santa Fe Independent School District

  Information literacy is important in this environment

Information literacy is critically important in this contemporary environment

  Associative property of multiplication

Write a definition for associative property of multiplication.

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