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

Create and initialize a string array, write and use 3 functions.Write a program. Create a string...
Create and initialize a string array, write and use 3 functions.Write a program. Create a string array in the main(),called firstNameArray, initialize with7 first namesJim, Tuyet, Ann, Roberto, Crystal, Valla, Mathilda Write a first function, named searchArray, that passes two arguments: a single person’s name and the array reference, into a function,This function should then search the array to see if the name is in the firstNameArray. If found, it will return the array index where the name is found,...
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....
write a java prog that include an array of strings of size 50    String[] strings...
write a java prog that include an array of strings of size 50    String[] strings = new String[50]; then find the max length of the inputs inside a method keep reading from the user until user enters keyword to stop input : may ala jony ram asd fgghff daniel jwana output : max length : 10
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,...
IN java Create a New Java Project called LastNameDuplicate. //Given an array of N elements with...
IN java Create a New Java Project called LastNameDuplicate. //Given an array of N elements with each element between 1 and N, write a program to determine whether there are any duplicates. //You must prompt the user for the array elements. //Display the contents of the array, along with the values that are duplicated and how many times they appeared in the array. //NOTE: N should be at least 15. Input Validation: Verify that each element entered has a value...
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...
Complete the program used on the instructions given in the comments: C++ lang #include <string> #include...
Complete the program used on the instructions given in the comments: C++ lang #include <string> #include <vector> #include <iostream> #include <fstream> using namespace std; vector<float>GetTheVector(); void main() { vector<int> V; V = GetTheVector(); //reads some lost numbers from the file “data.txt" and places it in //the Vector V Vector<int>W = getAverageOfEveryTwo(V); int printTheNumberOfValues(W) //This should print the number of divisible values by 7 //but not divisible by 3. PrintIntoFile(W); //This prints the values of vector W into an output file...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT