Write a program that asks the user to input an integer n

Assignment Help JAVA Programming
Reference no: EM131915579

Assignment

Program 1

A local school system must report average weekly attendance percentages to the state on each Friday afternoon. Your task is to write a program that takes multiple school's attendance numbers for a week and computes the information needed for the report to the state.

Your program should first ask the user how many schools there are in the district. The program should then ask the user to enter each day's attendance numbers for each school for the week as well as the number of students enrolled in that school. The program should output the average attendance for the week for each school as well as the average percentage of students present that week. You must use nested FOR loops to collect the attendance input from the user. You are NOT allowed to use an array for any purpose in your program.

All console output should have meaningful descriptions. While you can't yet recover from errors generated by users entering character data for input, make sure you validate numbers entered by the user are within appropriate numeric ranges for correct input to the program. For example, the program wouldn't do anything if there were 0 schools entered. There are other cases to figure out on your own.

Program 1 sample execution & output (user input shown in bold):

How many schools do you have in your district: 2

Enter data for school 1
How many students are enrolled in school 1: 580
Enter the attendance for day 1: 502
Enter the attendance for day 2: 521
Enter the attendance for day 3: 550
Enter the attendance for day 4: 555
Enter the attendance for day 5: 568

School 1 had an average attendance of 539 students which means there were 92.93% of all students present

Enter data for school 2

How many students are enrolled in school 1: 350
Enter the attendance for day 1: 302
Enter the attendance for day 2: 332
Enter the attendance for day 3: 350
Enter the attendance for day 4: 325
Enter the attendance for day 5: 338

School 2 had an average attendance of 329 students which means there were 94% of all students present

School 2 had the best attendance this week with 94% attendance.

Program 2

Write a program that asks the user to input an integer, n. Use the value of n to set the size of the triangles to be printed by your program to the console as shown below.

If 6 was entered by the user as n, the first triangle printed by your program would look like this.
@
@@
@@@
@@@@
@@@@@
@@@@@@

Then, the 2nd triangle printed by your program would look like this.:

              @
           @@
        @@@
      @@@@
   @@@@@
@@@@@@

The triangles should notbe produced by 6 println statements, but rather byFOR loops and no more than threeprintln or print statements in each set of loops to produce each triangle. Furthermore, a single println or print statement cannot contain more than one @ symbol in its output. (hint - use a set of nested FOR loops for each triangle to control how many times the print statements execute.) Also, just like in program 1, you may not use an array for any purpose in this program.

You should print a single blank line after the first triangle so there is space between the two triangles in your console output.

Reference no: EM131915579

Questions Cloud

Literature review - conduct a conscientious search : Use of laptops and tables in the classroom and Use and perceptions of digital technology among postgraduate students - exercise among postgraduate students
Explain how important are communication skills in project : Explain How important are communication skills in project management? Was Herb the right person to be assigned as project manager?
How much gain will linda report as a result of the sale : Linda pays $100,000 cash for Jerry's ¼ interest in the JILL Partnership. How much gain will Linda report as a result of the sale
Calculate the effective tax rate for each corporation : Calculate the effective tax rate for each corporation. Explain why the marginal tax rate for a C Corporation can exceed 35% but the effective tax rate cannot
Write a program that asks the user to input an integer n : Write a program that asks the user to input an integer, n. Use the value of n to set the size of the triangles to be printed by your program.
What is the amount of doug taxable income : During 2012, Doug incurs the following deductible expenses: $2,300 in the state income taxes, What is the amount of Doug's taxable income
What would the court look to in making its decision : What is the impact of the court's decision on the ability of the family to recover for injuries?
Review the implementation plan in significant enough depth : Review the implementation plan in significant enough depth to demonstrate your thorough understanding of the implementation process.
Establishment of the company - legal aspects of management : Choose any LLC, SAOC or SAOG Company - Formation/establishment of the company and Dissolution and liquidation of the Company

Reviews

Write a Review

JAVA Programming Questions & Answers

  Create a circle class

create acircle class, which has one field, the radius. the class should contains two constructors: a no-argument constructor that set the radius to zero, and a constructor that takes a parameter to set the radius.

  Create a robot that meets

Does NOT use the AdvancedRobot class - Uses at least 8 of the methods in the Robot class.

  Program that allows the user to enter an unknown number

Writer a program that allows the user to enter an unknown number of characters, stores those characters in a data structure (a vector) and then prints the values to the screen.

  Write java method for determine if string s has more vowels

Use recursion to write a Java method for determining if a string s has more vowels than consonants.

  Create pipe-and-filter network that will read data stream

Create a pipe-and-filter network that will read the data stream in FlightData.dat file, convert the temperature measurements from Fahrenheit to Celsius, and convert altitude from feet to meters - How would this impact the key quality attributes of ..

  Functional abstraction

Question 1: What are some of the benefits of modularity? Question 2: What is functional abstraction? Question 3: What is information hiding?

  Write a program that takes as input a number base

Write a program that reads an integer value n, and then reverses its digits - Write a program that reads an integer value n, then it reads in n integer values

  Write a java program - initialize a counter

Gets input for temperature Utilizing a branching statement: If temperature is 76-100, call method outputHot passing the temperature input as an argument.

  World data query system - determine users desired continent

CS1110 World Data Query System - alls getContinent to determine user's desired continent. Searches data to find ALL matching countries in that target continent

  Write a postfixcalculator class

Write a PostfixCalculator class - create multiple implementations of the operator interface in order to do this - You should have two private member variables

  Write your own http client to test your server

Write your own HTTP client to test your server. Your client will connect to the server using a TCP connection, send an HTTP request to the server

  Write the buttonhandler inner class

The output string should say something like this: "The RC time constant for resistance 1000 and capacitance .000001 is 0.001 seconds." Clicking one of the buttons generates the event which causes the program to do the selected calculation and upda..

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