TemperatureNurse 1

Write a Java program that does the following:
1. In the main() method complete the following:
1. Ask user to enter number of days that was patient entered to the hospital ( i.e 5 days)
2. Enter number of times that nurse read the temperature of patient in Celsius (3,4, 5, time or even more) 4. Within the loop, ask the user to enter temperature were read by nurse. 5. Within the loop, store each temperature in your array. 6. If the user enters a temperature below 33.5C or above 42C, then display an error message and keep looping till read the right one.
2. Write just one method call it Summary that called from main method and return average,maximum, and minimum of temperatures. Print the result on screen from main method.
3. Call another method call it belowAboveAverage that will return number of temperatures less than or equal to average of temperatures, and number of temperatures above the average.
4. Call a method sorting call it sortedArray that will sort using binary the temperatures in ascending order during all days store it in new 2D dimensional array and return it to main. 5. Call printArray method to print the sorted array on screen.
Days #of Readings Actual Reading Per Day (in Celsius ) 1 4 40.5 41 39.8 38.7 2 5 41.2 41.3 40.7 40.8 41.3 3 5 40.9 38.5 38.9 40.1 39.8 4 3 38.2 38.2 37.9 5 2 37.5 37.2


PairWise 2

In this exercise, we are looking for all pairwise multiplications between numbers from a
given list of numbers. In particular, you are given a list of integers. We are then looking
for possible multiplications that can be created by pairs of two out of the given
numbers. For example, when the input list contains the numbers 1, 2 and 3, then the
pairwise multiplications are 2 (1*2 ), 3 ( 1*3 ) and 6 (2*3 ). The found pairwise
multiplications have to be returned in a list.Your program should:
– Take as input a List of numbers
– Return all pairwise multiplications as a List
– Have the following signature:
public static List getPairwiseMultiplications(List
numbers)Moreover, take into account the following when writing your program:
– Each pairwise multiplication of two numbers in the list should be included only
once in the returned list.
– If two pairs of numbers have the same pairwise multiplication, you should include
only one result. For example, when the numbers 2, 3, 4 and 6 are all included in
the input list, then both 2*6 and 3*4 result in 12. However, 12 should be included
only once in the output.
– Your program should be able to handle a list of all sizes as input, even an empty
list or a list with one element. In both these cases, it should return an empty list.
– The order of elements in the output lists is not important, so you can have an
output that contains the same elements but in a different order.
– You can assume that all multiplications can fit into a variable of the int type.


FinanceAndSavings 3

For this week’s assignment you will write a program that calculates the finances and savings needed for attending a 4 year college by creating a program that performs arithmetic calculations. The program should ask the user to enter information for the following questions: 1. What is the total cost of a 4 year college? 2. How much money can you save in a month for this college?3. How much in additional gift money or scholarship will be given to you?4. How many more years until you can attend this college? For questions (1 -3) the program should accept decimal values from the user. Question 4 should accept an integer from the user. The program should output several key information including: 1. Total cost of the 4 year college. 2. Total money you can save per year. 3. Given the number of years until you start college, how much money would you have saved. 4. How much in total money do you have including gifts and scholarship? 5. Overall how much money more money is needed to attend the college or how much is the surplus. You will need to submit the code in the assignment submission link in order to confirm successful run.


Customer 4

Write a java console application to input, calculate and output the following:- Ask the user to input the following:
Customer’s Name
Number of items the customer purchased
The item price- Calculate using the following formulae:
Gross payment = Number of items * item price
goods and services tax (GST) = Gross payment * (10/100)
Net payment = Gross payment + GST- Output the following:
Customer’s Name
Number of items the customer purchased
The item price
Gross payment
Net payment


TotalCoins 5

Write a program that determines the value of the coins in a jar and prints the total in dollars
and cents. Read integer values that represent the number of quarters, dimes, nickels, and
pennies. This program will require user input, output needs to have the correct currency
format without using the currency formatting code.

Teaching UML & JAVA

Teaching UML & JAVA 6

Read the following short passage of the text to identify the class candidates as well as their possible relationships – composition or aggregation that might exist among them:
Assume that we defined a teaching course with attributes: name, dept, year, semester (with values F – “Fall”, S- “Summer”, W- “Winter”).
Also semester is associated with:
– course description (a paragraph of text),
– professor with his office number, and a phone extension (note that one course could be instructed by only one instructor, and one instructor may teach several courses at the same time),
– student may be enrolled to the course (note that course may have up to 30 students), and each student should receive an average course mark.1) First you have design a UML class diagram. You may choose to use aggregation/ composition – where necessary.
2) Java implementation: Implement all required classes in Java, according to UML class diagram. Create a test class with one course instructed by one specific professor, and add a list of students enrolled into this course. Note: at the end, the program should calculate a course average student’s mark for particular course. You are expected to add all programming comments in your code.


OddEvenDistance 7

Write a method that will check an array for an odd number followed by an even number. Find the first odd number. Then, after finding the odd number, start looking at that position for an even number and then return the distance between them. Return -1 if there are no odd numbers or no odd numbers followed by an even number.


NumberToWords 8

Program 11 – Strings
One common security method in check-writing requires that the amount be written in
numbers and spelled out in words as well. Even if someone is able to alter the
numerical amount of the check, it’s extremely difficult to change the amount in words.
Write a program that receives a numeric check amount, that is less than $1000.00, from
the user and writes the word equivalent of the amount.
For example, the amount 112.43 should be written as:
One Hundred Twelve and 43/100 dollars
Do not accept invalid amounts.
Allow the user to run the program as many times as possible until a sentinel value of
zero (0) has been entered for the check amount.
Run your program with the following data and copy and paste the output to a file:
No input, processing, or output should happen in the main method. All work
should be delegated to other non-static methods. Include the recommended
minimum documentation for each method. See the program one template for more
Every method in your program should be limited to performing a single, welldefined task, and the name of the method should express that task effectively.
Create a folder named, fullname_program11. Copy your source code and the output
file to the folder. Zip the folder and upload it to Blackboard.
You will not get credit if the program is not written or does not work as expected.


Rainfall 9

Write a program that stores the total amount of rain for each month in an array. Prompt the user for the values for each month to load the array. Display this information back to them in a nice format with the name of the month and the rainfall for that month. Display back the total rainfall for the year, the average monthly rainfall, the month with the most rain, the month with the least rain, the months with rainfall above average, and the months with rainfall below average. Do not accept negative numbers from the user to be stored in the array.Be sure to test your code with different values and to comment your code completely. Make sure your code is user friendly and the output is formatted nicely.HINT: Break this problem up into pieces. For instance, load the array and display it back out. Get this to work first. Then add the functionality to display the total amount of rain. When that works add the next piece, and so on.Note that this project must be done individually. The program will be checked using a code plagiarism tool against other solutions, so please ensure that all work submitted is your own.You may read and write from the console window.You are to submit your source file, called Rainfall.java in Moodle by the due date.


HollowPlusSign 10

Write a program that prints a hollow plus sign. Ask the user what size plus sign he/she wants and print it out. Name your program Unit9Assignment.Example 1:This program prints a hollow plus sign.
What size plus sign would you like? 6Here is your plus sign of size 6:* *
* *
* * * * * *
* * * * * *
* *
* *
Example 2:This program prints a hollow plus sign.
What size plus sign would you like? 9Here is your plus sign of size 9:* * *
* *
* *
* * * * * * * *
* *
* * * * * * * *
* *
* *
* * *
Example 3:This program prints a hollow plus sign.
What size plus sign would you like? 15Here is your plus sign of size 15:* * * * *
* *
* *
* *
* *
* * * * * * * * * * * *
* *
* *
* *
* * * * * * * * * * * *
* *
* *
* *
* *
* * * * *
Example 4:This program prints a hollow plus sign.
What size plus sign would you like? 0
The size must be positive and divisible by 3.
What size plus sign would you like? 1
The size must be positive and divisible by 3.
What size plus sign would you like? -3
The size must be positive and divisible by 3.
What size plus sign would you like? 3Here is your plus sign of size 3:*
* * *
Hint #1: the mod operator (%) can be used to determine if a number is ***** by 3.Hint #2: there is a lot of duplicate work in printing the various parts of the plus sign. Writing methods will save you a lot of coding and make your program simpler.

New Download