Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java Code Don't worry about the Test Cases Description: Thin square metal plates are to be tested for its thermal conductivity. Starting with the metal

image text in transcribedimage text in transcribedimage text in transcribed

Java Code

Don't worry about the Test Cases

Description: Thin square metal plates are to be tested for its thermal conductivity. Starting with the metal plate at room temperature (68), a constant (but possibly different) temperature is applied to each of its four edges. The temperature of the metal plate changes as the temperature applied to the edges flows into the plate. Its thermal conductivity is measured by the time it takes to reach a steady state. The steady state occurs when each interior point of the metal plate reaches a temperature which does not change significantly from one time unit to the next. Since we will not go into the physics laboratory to perform this experiment, the purpose of this assignment is to write a program that will model (simulate) this experiment. To perform a simulation, we must design representations for the objects involved in the simulation. The only object in this simulation is the metal plate. The metal plate is best simulated by a two- dimensional array. Each element of the array represents a particular square on the plate. The contents of each element of the array will contain the current temperature of that square. The temperature of a square is affected by its horizontally and vertically adjacent squares. Finding the new temperature of each square is accomplished by averaging the old temperatures of the square and its four neighbors. f Ty denotes the old temperature of the square in rowi and column j at time tm, then + T i-1,j i,j+i i+1 will be its new temperature at time tmti. The simulation will start at time to with the initial state as described below and continue until sometime t when the steady state has been reached. We will specify that the steady state occurs when the temperature of every square at time t+1 differs from the temperature of the square at time tm by at most 0.1 The initial temperature of the plate for any simulation will be 68. The size of the plate should be 10 squares by 10 squares. However, I would create an array of size 12 by 12 so that I also have room to store the edge temperatures. This simplifies the calculations since you don't have to worry about squares along the edges of the plate. The coners of the 12 by 12 array will then be void of data Note: All new temperatures (at time to+i) must be calculated from all old temperatures (at time t) Input: None. Output: None. Return an array of Plate* classes containing 2-dim arrays with the resulting state of the plate after it has reached a "steady state." The required method is provided below. Each line in the file wil contain 4 numbers separated by a comma. The file can/will have multiple lines, each line should be treated as a unique execution and the plate should be reset to room temperature. A sample of the correct output has been provided for a file containing the values: 50, 50, 50, 50. The values are provided in the order of Top, Right, Bottom, Left. Note: For your output use the following decimal formatter on your calculation line. DecimalFormat twoDForm-new DecimalFormat("#.##"); Required Method(s) (Lab 3 Class): public static Plate[] processTempsFromFile(File f, int numPlates) throws FileNotFoundException First Parameter: File object-this may or may not be a valid file, check it! Second Parameter: Number of plates (four #'s on a line) in the file. Essentially this tells you the number of lines in the file. . Required Method(s) (Plate Class): public Plate (double[][] plate) public double[]] getPlate() Packaging: Fully qualified class names are listed below: (Note: the bold is the class itself) edu.ben.labs.lab3.Lab3 edu.ben.labs.lab3.Lab3Test edu hen lahs lah3 Plate Sample Solution: 0.00, 50.00, 50.00, 50.00, 50.00, 50.00, 50.00, 50.00, 50.00, 50.00, 50.00, 0.00 50.00, 50.23, 50.44, 50.61, 50.74, 50.80, 50.80, 50.74, 50.61, 50.44, 50.23, 50.00 50.00, 50.44, 50.84, 51.17, 51.41, 51.54, 51.54, 51.41, 51.17, 50.84, 50.44, 50.00 50.00, 50.61, 51.17, 51.64, 51.98, 52.15, 52.15, 51.98, 51.64, 51.17, 50.61, 50.00 50.00, 50.74, 51.41, 51.98, 52.38, 52.59, 52.59, 52.38, 51.98, 51.41, 50.74, 50.00 50.00, 50.80, 51.54, 52.15, 52.59, 52.82, 52.82, 52.59, 52.15, 51.54, 50.80, 50.00 50.00, 50.80, 51.54, 52.15, 52.59, 52.82, 52.82, 52.59, 52.15, 51.54, 50.80, 50.00 50.00, 50.74, 51.41, 51.98, 52.38, 52.59, 52.59, 52.38, 51.98, 51.41, 50.74, 50.00 50.00, 50.61, 51.17, 51.64, 51.98, 52.15, 52.15, 51.98, 51.64, 51.17, 50.61, 50.00 50.00, 50.44, 50.84, 51.17, 51.41, 51.54, 51.54, 51.41, 51.17, 50.84, 50.44, 50.00 50.00, 50.23, 50.44, 50.61, 50.74, 50.80, 50.80, 50.74, 50.61, 50.44, 50.23, 50.00 0.00, 50.00, 50.00, 50.00, 50.00J 50 .00, 50 .00, 50 .00, 50.00, 50 .00, 50.00 0.00 Description: Thin square metal plates are to be tested for its thermal conductivity. Starting with the metal plate at room temperature (68), a constant (but possibly different) temperature is applied to each of its four edges. The temperature of the metal plate changes as the temperature applied to the edges flows into the plate. Its thermal conductivity is measured by the time it takes to reach a steady state. The steady state occurs when each interior point of the metal plate reaches a temperature which does not change significantly from one time unit to the next. Since we will not go into the physics laboratory to perform this experiment, the purpose of this assignment is to write a program that will model (simulate) this experiment. To perform a simulation, we must design representations for the objects involved in the simulation. The only object in this simulation is the metal plate. The metal plate is best simulated by a two- dimensional array. Each element of the array represents a particular square on the plate. The contents of each element of the array will contain the current temperature of that square. The temperature of a square is affected by its horizontally and vertically adjacent squares. Finding the new temperature of each square is accomplished by averaging the old temperatures of the square and its four neighbors. f Ty denotes the old temperature of the square in rowi and column j at time tm, then + T i-1,j i,j+i i+1 will be its new temperature at time tmti. The simulation will start at time to with the initial state as described below and continue until sometime t when the steady state has been reached. We will specify that the steady state occurs when the temperature of every square at time t+1 differs from the temperature of the square at time tm by at most 0.1 The initial temperature of the plate for any simulation will be 68. The size of the plate should be 10 squares by 10 squares. However, I would create an array of size 12 by 12 so that I also have room to store the edge temperatures. This simplifies the calculations since you don't have to worry about squares along the edges of the plate. The coners of the 12 by 12 array will then be void of data Note: All new temperatures (at time to+i) must be calculated from all old temperatures (at time t) Input: None. Output: None. Return an array of Plate* classes containing 2-dim arrays with the resulting state of the plate after it has reached a "steady state." The required method is provided below. Each line in the file wil contain 4 numbers separated by a comma. The file can/will have multiple lines, each line should be treated as a unique execution and the plate should be reset to room temperature. A sample of the correct output has been provided for a file containing the values: 50, 50, 50, 50. The values are provided in the order of Top, Right, Bottom, Left. Note: For your output use the following decimal formatter on your calculation line. DecimalFormat twoDForm-new DecimalFormat("#.##"); Required Method(s) (Lab 3 Class): public static Plate[] processTempsFromFile(File f, int numPlates) throws FileNotFoundException First Parameter: File object-this may or may not be a valid file, check it! Second Parameter: Number of plates (four #'s on a line) in the file. Essentially this tells you the number of lines in the file. . Required Method(s) (Plate Class): public Plate (double[][] plate) public double[]] getPlate() Packaging: Fully qualified class names are listed below: (Note: the bold is the class itself) edu.ben.labs.lab3.Lab3 edu.ben.labs.lab3.Lab3Test edu hen lahs lah3 Plate Sample Solution: 0.00, 50.00, 50.00, 50.00, 50.00, 50.00, 50.00, 50.00, 50.00, 50.00, 50.00, 0.00 50.00, 50.23, 50.44, 50.61, 50.74, 50.80, 50.80, 50.74, 50.61, 50.44, 50.23, 50.00 50.00, 50.44, 50.84, 51.17, 51.41, 51.54, 51.54, 51.41, 51.17, 50.84, 50.44, 50.00 50.00, 50.61, 51.17, 51.64, 51.98, 52.15, 52.15, 51.98, 51.64, 51.17, 50.61, 50.00 50.00, 50.74, 51.41, 51.98, 52.38, 52.59, 52.59, 52.38, 51.98, 51.41, 50.74, 50.00 50.00, 50.80, 51.54, 52.15, 52.59, 52.82, 52.82, 52.59, 52.15, 51.54, 50.80, 50.00 50.00, 50.80, 51.54, 52.15, 52.59, 52.82, 52.82, 52.59, 52.15, 51.54, 50.80, 50.00 50.00, 50.74, 51.41, 51.98, 52.38, 52.59, 52.59, 52.38, 51.98, 51.41, 50.74, 50.00 50.00, 50.61, 51.17, 51.64, 51.98, 52.15, 52.15, 51.98, 51.64, 51.17, 50.61, 50.00 50.00, 50.44, 50.84, 51.17, 51.41, 51.54, 51.54, 51.41, 51.17, 50.84, 50.44, 50.00 50.00, 50.23, 50.44, 50.61, 50.74, 50.80, 50.80, 50.74, 50.61, 50.44, 50.23, 50.00 0.00, 50.00, 50.00, 50.00, 50.00J 50 .00, 50 .00, 50 .00, 50.00, 50 .00, 50.00 0.00

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Sams Teach Yourself Beginning Databases In 24 Hours

Authors: Ryan Stephens, Ron Plew

1st Edition

067232492X, 978-0672324925

More Books

Students also viewed these Databases questions

Question

b. What groups were most represented? Why do you think this is so?

Answered: 1 week ago