I need to write a program in java using two array lists. I need to program to prompt the user to enter a day of the week and return an output of a predetermined temperature for the day they selected. I also need the program the output the average of daily temperatures across the week if the user inputs "week".
So basically if i set the temperatures to something arbitrary i.e.:
Monday = 50
Tuesday = 55
Wednesday = 52
Thursday = 50
Friday = 52
Saturday = 55
Sunday = 57
And the user enters "Monday" i need the output to display something like "The temperature for Monday will be: 50 degrees"
import java.util.Scanner;
public class MonthTemparature {
public static void main(String args[]){
int arr[] = {50,55,52,50,52,55,57};
double average = 0;
for(int i = 0;i<arr.length;i++){
average += arr[i];
}
average /= arr.length;
Scanner scanner = new Scanner(System.in);
System.out.println("Enter day:");
String s = scanner.nextLine();
if(s.equalsIgnoreCase("monday")){
System.out.println("The temperature for "+s+" will be: "+arr[0]+" degrees");
}
else if(s.equalsIgnoreCase("tuesday ")){
System.out.println("The temperature for "+s+" will be: "+arr[1]+" degrees");
}
else if(s.equalsIgnoreCase("wednesday ")){
System.out.println("The temperature for "+s+" will be: "+arr[2]+" degrees");
}
else if(s.equalsIgnoreCase("thursday ")){
System.out.println("The temperature for "+s+" will be: "+arr[3]+" degrees");
}
else if(s.equalsIgnoreCase("friday ")){
System.out.println("The temperature for "+s+" will be: "+arr[4]+" degrees");
}
else if(s.equalsIgnoreCase("saturday ")){
System.out.println("The temperature for "+s+" will be: "+arr[5]+" degrees");
}
else if(s.equalsIgnoreCase("sunday ")){
System.out.println("The temperature for "+s+" will be: "+arr[6]+" degrees");
}
else if(s.equalsIgnoreCase("week ")){
System.out.println("The temperature for "+s+" will be: "+average+" degrees");
}
}
}
I need to write a program in java using two array lists. I need to program...
Coding in C++ Write a program using structures to store the following weather information: - Month name - Day of month (Monday, Tuesday, etc) - High Temperature - Low Temperature - Rainfall for the day Use an the input.txt file to load the data into weather structures. Once the data for all the days is entered, the program should calculate and display the: - Total rainfall for the data - Average daily temperatures. (note: you'll need to calculate the days...
1. Day of the Week Write a program that asks the user for a number in the range of 1 through 7. The program should display the corresponding day of the week, where 1 = Monday, 2 = Tuesday, 3 = Wednesday, 4 = Thursday, 5 = Friday, 6 = Saturday, and 7 = Sunday. The program should display an error message if the user enters a number that is outside the range of 1 through 7. (On PYTHON IDLE...
Need this program ASAP
C++ language
1b. Write the implementation file timeClock.cpp for the class TimeClock. Com pile the file, and save it in the Chap 13 folder of your Student Data Files. 1c. Write a C++ program named weeklyPay.cpp to test your class Timeclock Your program should ask the user how many hours the user worked each day of the week. An object should be created for each day of the week with the number of hours for each...
I have counted the number of statistics problems I do every day. The following data lists the day of the week and how many problems I did on that day in the second column. The third column gives the percent of problems theory suggests I should have done. Sunday 25 0 Monday 102 20 Tuesday 87 10 Wednesday 122 20 Thursday 76 10 Friday 111 20 Saturday 50 20 Test if I followed the theory at α=10%
Write a php script that assigns the days of the week to an array named $days[]. Use output statements to display "The days of the week in English are: " along with the values in the $days[ ] array. Following the output statements, reassign the values in the $days[ ] array with the day of the week in French. Sunday is Dimanche, Monday is Lundi, Tuesday is Mardi. Wednesday is Mercredi. Thursday is Jeudi. Friday is Vendredi, and Saturday is Samedi....
week_days<- c("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday") How do i write a line of code that will select the days Wednesday, Saturday, and Sunday in Rstudio?
Need Help Filling in Areas: /** Based on a Big Java problem You have to write a static method that removes every other element from a linked list. Expected output: [Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday] [Monday, Wednesday, Friday] [Wednesday] [] */ public class DownSizeTester { public static void main(String[] args) { LinkedList list = new LinkedList() ; list.add("Sunday") ; list.add("Monday") ; list.add("Tuesday") ; list.add("Wednesday") ; list.add("Thursday") ; list.add("Friday") ; list.add("Saturday") ; System.out.println(list) ; downsize(list) ; System.out.println(list) ; downsize(list)...
Using the function you wrote in part 3a (refer to the bottom), write another function that, given the number of days in the month, and the day that the month starts on, the number of days that Inky Blinky Pinky and Clyde will get to play pinball in that month. The function provided will increment the day of the week to the next correct day. Function written in 3a): def pinball(dayOfWeek, dayOfMonth) : if dayOfMonth % 4 ==0: return "Pinky"...
The table below lists the number of crimes reported at a police station on each day of the week for the past three months. Day of the WeekNumber of Crimes Monday Tuesday Wednesday Thursday Friday Saturday Sunday The null hypothesis for the goodness-of-fit test is that the number of crimes reported at this police station is the same for each day of the week. What is the expected number of crimes reported on a Thursday?
PYTHON CODE First Code: Write a program that uses a text file to store the daysand hours that a user worked in a week. The program should begin by prompting for the number of days worked in the week. It should continue with a loop for input of the days and hours and for writing these to the file, each on its own line. Sample Output (inputs shown in boldface) How many days did you work this week? 5 Enter...