Electric wire, like that in the photo, is a cylindrical conductor covered by an insulating material. The resistance of a piece of wire is given by the formula
where ρ is the resistivity of the conductor, and L, A, and d are the length, crosssectional area, and diameter of the wire. The resistivity of copper is 1.678 × 10−8 Ω m.
The wire diameter, d, is commonly specified by the American wire gauge (AWG), which is an integer, n. The diameter of an AWG n wire is given by the formula
Write a method
public static double diameter(int wireGauge)
that accepts the wire gauge and returns the corresponding wire diameter. Write another method
public static double copperWireResistance(double length, int wireGauge)
that accepts the length and gauge of a piece of copper wire and returns the resistance of that wire. The resistivity of aluminum is 2.82 × 10−8 Ω m. Write a third method
public static double aluminumWireResistance(double length, int wireGauge)
that accepts the length and gauge of a piece of aluminum wire and returns the resistance of that wire.
Write a program to test these methods.
Want to see the full answer?
Check out a sample textbook solutionChapter 5 Solutions
Big Java Late Objects
Additional Engineering Textbook Solutions
Java: An Introduction to Problem Solving and Programming (8th Edition)
C++ How to Program (10th Edition)
Management Information Systems: Managing the Digital Firm (15th Edition)
Concepts Of Programming Languages
Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
- Draw a CIRCLE OF UNIT RADIUS: Use parametric equation of unit circle x=cos , y= sin 0arrow_forwardThe spring in the figure below is stretched from its equilibrium position at x = 0 to a positive coordinate xo. ko HINT x = 0 x = xo PE sn PE 50 The force on the spring is F and it stores elastic potential energy PESO. If the spring displacement is tripled to 3x, determine the ratio of the new force to the original force, and the ratio of the new to the original elastic potential energy, Fo Fo PESO (a) the ratio of the new force to the original force, PE ST PE SO (b) the ratio of the new to the original elastic potential energy,arrow_forwardQ1/The pressure drop in pascals (Pa) for a fluid flowing in a pipe with a sudden decrease in diameter can be determined based on the loss of head equation given below: h = 24-11 2g Area A Area A Area A Where: V₂ is the velocity in position 2 (m/s), g: is acceleration due to gravity = 9.81 m/s², A₁ and A₂ are the cross-sectional areas of the tube in position 1 and 2 respectively. A==d² Where: d is the diameter (m). Write a program in a script file that calculates the head loss. When the script file is executed, it requests the user to input the velocity (V₂) in m/s and values of diameters (d, and d₂). The program displays the inputted value of v followed by a table with the values of diameters in the first and second columns and the corresponding values of h, in the third column. 2 2arrow_forward
- A standard science experiment is to drop a ball and see how high it bounces. Once the “bounciness” of the ball has been determined, the ratio gives a bounciness index. For example, if a ball dropped from a height of 10 feet bounces 6 feet high, the index is 0.6 and the total distance traveled by the ball is 16 feet after one bounce. If the ball were to continue bouncing, the distance after two bounces would be 10 ft + 6 ft + 6 ft + 3.6 ft = 25.6 ft. Note that distance traveled for each successive bounce is the distance to the floor plus 0.6 of that distance as the ball comes back up. Write a program that lets the user enter the initial height of the ball and the number of times the ball is allowed to continue bouncing. Output should be the total distance traveled by the ball. Please name your function "bounce" that has three arguments (initial height, index, number of bounce) and return the total distance traveled by the ball. (float) Skip the part where users can enter the inputs of…arrow_forwardThe Harris-Benedict equation estimates the number of calories your body needs to maintain your weight if you do no exercise. This is called your basal metabolic rate, or BMR. The calories needed for a woman to maintain her weight is: WBMR = 655 + (4.3 × weight in pounds) + (4.7 × height in inches) − (4.7× age in years) The calories needed for a man to maintain his weight is: MBMR = 66 + (6.3 × weight in pounds) + (12.9 × height in inches) − (6.8 × age in years) A typical chocolate bar will contain around 230 calories. Write a java program that allows the user to input his or her weight in pounds, height in inches, and age in years. The program should then output the number of chocolate bars that should be consumed to maintain one’s weight for both a woman and a man of the input weight, height, and age. NOTE: This is an application of a selection statement! Input Data: Use a named constant for the number of calories in a “typical chocolate bar.” Use Scanner methods to enter the…arrow_forwardMatlab A rocket is launched vertically and at t-0, the rocket's engine shuts down. At that time, the rocket has reached an altitude of ho- 500 m and is rising at a velocity of to 125 m/s. Gravity then takes over. The height of the rocket as a function of time is: h(t)-ho+vot-gt², t20 where g -9.81 m/s². The time t-0 marks the time the engine shuts off. After this time, the rocket continues to rise and reaches a maximum height of Amax meters at time t = tmax. Then, it begins to drop and reaches the ground at time t = tg. a. Create a vector for times from 0 to 30 seconds using an increment of 2 s. b. Use a for loop to compute h(t) for the time vector created in Part (a). e. Create a plot of the height versus time for the vectors defined in Part (a) and (b). Mark the and y axes of the plot using appropriate labels. d. Noting that the rocket reaches a maximum height, max, when the height function, h(t), attains a maxima, compute the time at which this occurs, max, and the maximum height,…arrow_forward
- A simple pendulum of length L, has a maximum angular displacement e_max. At one point in its motion, its kinetic energy is K = 3 J and its potential energy is U = 4.2 J. When the pendulum's angular velocity is one-fourth its maximum value (0' = %3D O'_max/4), then its kinetic energy is:arrow_forwardMatlab Programmingarrow_forwardTwo small charged objects attract each other with a force F when separated by a distance d.If the charge on each object is reduced to one-fourth of its original value and the distance between them is reduced to d/2,the force becomes?arrow_forward
- The flight of a model rocket can be modeled as follows. During the first 0.15 s the rocket is propelled upward by the rocket engine with a force of 16 N. The rocket then flies up while slowing down under the force of gravity. After it reaches the apex, the rocket starts to fall back down. When its downward velocity reaches 20 m/s, a parachute opens (assumed to open instantly), and the rocket continues to drop at a constant speed of 20 m/s until it hits the ground. Write a program that calculates and plots the speed and altitude of the rocket as a function of time during the flight. SOLVE WITH MATLAB PLEASEarrow_forward• A circuit consists of a 12 V battery connected across a single resistor. If the current in the circuit is 3 A, calculate the size of the resistor. If a small appliance is rated at a current of 10 amps and a voltage of 120 volts, the power rating would be?.arrow_forwardMatlabarrow_forward
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr