Question

In: Computer Science

Create a complete java program called Week_Report. The program must include two array structures, a string...

Create a complete java program called Week_Report. The program must include two array structures, a string array called DaysOfWeek and a double array called Temp_Values. Store in the DaysOfWeek array the following values (Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday). Store in the Temp_Values array the following (23.5, 34.0, 20.9, 45.7, 29.3, 34.5, 32.5). Using a for loop structure output the values for the two arrays.
Day of the Week Temperature Values
Monday 23.5
Tuesday 34.0
Wednesday 20.9
Thursday 45.7
Friday 29.3
Saturday 34.5
Sunday 32.5

Names for the main program and the array structures are provided in the question.

JAVA Language to be used

Solutions

Expert Solution

Step 1 : Save the following code in Week_Report.java

public class Week_Report {

   public static void main(String[] args) {
       String[] DaysOfWeek = {"Monday", "Tuesday", "Wednesday",
               "Thursday", "Friday", "Saturday", "Sunday"};
       double[] Temp_Values = {23.5, 34.0, 20.9, 45.7, 29.3, 34.5, 32.5};
       System.out.println("Day of the Week Temperature values");
       // Use for loop and print values. Array index starts from 0 and ends at n-1
       for(int i = 0; i < DaysOfWeek.length; i++) {
           // Leave a blank space between the 2 values and print
           System.out.println(DaysOfWeek[i] + " " + Temp_Values[i]);
       }
   }

}

Step 2 : Build the project and run the program.

Following is my sample output



Related Solutions

JAVA program Create a class called Array Outside of the class, import the Scanner library Outside...
JAVA program Create a class called Array Outside of the class, import the Scanner library Outside of main declare two static final variables and integer for number of days in the week and a double for the revenue per pizza (which is $8.50). Create a method called main Inside main: Declare an integer array that can hold the number of pizzas purchased each day for one week. Declare two additional variables one to hold the total sum of pizzas sold...
1.Write the java code to create a two dimensional String array of sizes 12 by 8;...
1.Write the java code to create a two dimensional String array of sizes 12 by 8; Given the java array:       double[] test = new double[3]; 2.  Write the java code to put the numbers 1.0, 2.0, and 3.0 in to the array so that the 1.0 goes in the first cell, the 2.0 goes in the second cell and the 3.0 goes in the third cell. 3. Can you have different types of data is a three dimensional array? 4....
Create a program in java with the following information: Design a program that uses an array...
Create a program in java with the following information: Design a program that uses an array with specified values to display the following: The lowest number in the array The highest number in the array The total of the numbers in the array The average of the numbers in the array Initialize an array with these specific 20 numbers: 26 45 56 12 78 74 39 22 5 90 87 32 28 11 93 62 79 53 22 51 example...
You must create two Java files. One is called LastNameFirstNameWeek6Prog.java, and the other is called  Museum.java. Ensure...
You must create two Java files. One is called LastNameFirstNameWeek6Prog.java, and the other is called  Museum.java. Ensure you include ALL files required to make your program compile and run. I would like to see your .java files only. 5% Museum.java Class File 1.    Create a new class called Museum that describes a Museum and includes the functionality below 2.    The new class has the following five attributes: a. officialName – the museum’s given name (i.e.:“ New Orleans Museum of Arts”,etc.), type...
Write a complete Java program called CharCounter that gets two Strings called inputWord and inputCharacter from...
Write a complete Java program called CharCounter that gets two Strings called inputWord and inputCharacter from the user at the command line. Check that the character has a length of 1. If it doesn't, provide the user with suitable feedback and conclude the program. If the character length is valid (i.e., it has a length of 1), use a while loop to check each position in the inputWord variable and return the number of times the character occurs. For example,...
Write a Java program that prompts the user to input a word (String). The program must...
Write a Java program that prompts the user to input a word (String). The program must print the reversed word with all consecutive duplicate characters removed. The program must contain the following classes: - The StackX class (you can use the Java Stack class). - The Reverse class which must contain a private data field called “word” of type string, a constructor, and a void method called revNoDup(). The revNoDup() method must reverse the word and remove the consecutive duplicate...
Instructions: Create a Java program that reads a string entered by the user and then determines...
Instructions: Create a Java program that reads a string entered by the user and then determines and prints how many of each lowercase vowel (a, e, i, o, and u) appear in the entire string. Have a separate counter for each vowel. Also, count and print the number of non-vowel characters. Example: User enters: "This house is beautiful." a: 1 e: 2 i: 3 o: 1 u: 2 non-vowel:10
Write a Java program to create an array of a specific size (which is an input...
Write a Java program to create an array of a specific size (which is an input from the user) and fill it with random numbers between 1 and 100. Then sort the array and count how many of these numbers are originally at sorted position. Display that original array, the sorted array, and the count (number of elements originally at sorted position).
Create a program “Fib.java” and a method called “double[] getFib)” that creates an array with a...
Create a program “Fib.java” and a method called “double[] getFib)” that creates an array with a length of 15 that contains the first 15 numbers in the Fibonacci sequence and returns it. Set the first element to 0 and the second element to 1, then use a for loop to fill out the rest of the array.
Write a Java program that creates a three-dimensional array. Populate each element with a string that...
Write a Java program that creates a three-dimensional array. Populate each element with a string that states each coordinate position in the array.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT