Project #40918 - Java homework

NUMBER 1

HOMEWORK

 

Write a program that takes in temperatures for 10 days.  Find the average temperature for those 10 days, and then print the number of days and the temperatures that were above average.

 

Example Dialog:

 

Welcome to the above average temperature tester program.

 

Please enter the temperature for day 1

97

Please enter the temperature for day 2

87

Please enter the temperature for day 3

85

Please enter the temperature for day 4

76

Please enter the temperature for day 5

83

Please enter the temperature for day 6

104

Please enter the temperature for day 7

78

Please enter the temperature for day 8

76

Please enter the temperature for day 9

90

Please enter the temperature for day 10

85

 

The average temperature was 86.1

The days that were above average were

Day 1 with 97

Day 2 with 87

Day 6 with 104

Day 9 with 90

 

DONE!

 

 

 

 

NUMBER 2

HOMEWORK

 

 

 

Create a Java program that solves the "Four Football Players" problem. There were four football players and they were caught in a misdeed. The judge sentenced them to a total of 200 hours of community service and said it was up to them how they divided up the work. The players agreed to start the next day.

The following morning, one of the players, who was lazier but not as dumb as the other three, said there was no reason for them all to do the same amount of work. He suggested the following scheme: the players would draw straws. A straw would be marked with a single number indicating both how many days the player must work and how many hours each day. For example, a player drawing a straw marked with a 3 would work for 3 hours a day for 3 days, making a total of 9 hours. The lazy player convinced the others to agree with this scheme and through trickery drew the best straw.

The problem is to determine all of the possible ways to divide up the work according to this scheme.

You will have to use nested loops to test all of the possible combinations of 4 numbers that will result in exactly 200 hours of work.

Couple of notes:

1.     There cannot be a 0 straw which indicates 0 days for 0 hours.

2.     Each straw must be unique so they cannot repeat values.

3.     Since this is combination you cannot have repeated results

Example: 2 4 6 12 and 4 2 6 12 are technically not a combination as the both contain the same values in different order, so only show 2 4 6 12

 

4.     Finally there is only one solution which is 2 4 6 12

Subject Computer
Due By (Pacific Time) 09/22/2014 10:00 pm
Report DMCA
TutorRating
pallavi

Chat Now!

out of 1971 reviews
More..
amosmm

Chat Now!

out of 766 reviews
More..
PhyzKyd

Chat Now!

out of 1164 reviews
More..
rajdeep77

Chat Now!

out of 721 reviews
More..
sctys

Chat Now!

out of 1600 reviews
More..
sharadgreen

Chat Now!

out of 770 reviews
More..
topnotcher

Chat Now!

out of 766 reviews
More..
XXXIAO

Chat Now!

out of 680 reviews
More..
All Rights Reserved. Copyright by AceMyHW.com - Copyright Policy