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
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)
- CODE IN PYTHON In an alternate reality, chemistry Professors Hodge and Sibia have teamed up to design a chemical compound X such that when X is added to Dan’s favorite food (saltine crackers), it’ll make him despise it. For this, they are working with 6 kinds of extracts: Singleton Extracts: berries (B), green veggies (G), dairy (D) Combination Extracts: icecream (I), salad (S), and cheese sauce (C) Like regular food, mixing two extracts of the same kind will result in an extract of the same kind (eg. mixing berries B with berries B will result in berries B). Mixing two singleton extracts will result in a combination extract, using these rules: Berries (B) + Green Veggies (G) = Salad (S) Berries (B) + Dairy (D) = Icecream (I) Green Veggies (G) + Dairy (D)= Cheese Sauce (C) Mixing two combination extracts will result in a singleton extract closest to them. For example, Icecream (I) + Salad (S) is closest to Berries (B) since both Icecream and Salad extracts require using Berry…arrow_forwardLet's begin with a lesson in roulette. Roulette is a casino game that involves spinning a ball on a wheel that is marked with numbered squares that are red, black, or green. Half of the numbers 1–36 are colored red and half are black and the numbers 0 and 00 are green. Each number occurs only once on the wheel. We can make many different types of bets, but two of the most common are to bet on a single number (1–36) or to bet on a color (either red or black). These will be the two bets we will consider in this project. After all players place their bets on the table, the wheel is spun and the ball tossed onto the wheel. The pocket in which the ball lands on the wheel determines the winning number and color. The ball can land on only one color and number at a time. We begin by placing a bet on a number between 1 and 36. This bet pays 36 to 1 in most casinos, which means we will be paid $36 for each $1 we bet on the winning number. If we lose, we simply lose whatever amount of money we…arrow_forwardLet's begin with a lesson in roulette. Roulette is a casino game that involves spinning a ball on a wheel that is marked with numbered squares that are red, black, or green. Half of the numbers 1–36 are colored red and half are black and the numbers 0 and 00 are green. Each number occurs only once on the wheel. We can make many different types of bets, but two of the most common are to bet on a single number (1–36) or to bet on a color (either red or black). These will be the two bets we will consider in this project. After all players place their bets on the table, the wheel is spun and the ball tossed onto the wheel. The pocket in which the ball lands on the wheel determines the winning number and color. The ball can land on only one color and number at a time. We begin by placing a bet on a number between 1 and 36. This bet pays 36 to 1 in most casinos, which means we will be paid $36 for each $1 we bet on the winning number. If we lose, we simply lose whatever amount of money we…arrow_forward
- A group of people, numbered 1 to N, are sitting in a circle. Starting at person 1, a hot potato is passed. After x number of passes, the person holding the hot potato is eliminated, the circle closes ranks, and the game continues with the person who was sitting after the eliminated person picking up the hot potato. The last remaining person wins. For example: number of passes = 1 and number of players = 5, the order of elimination is 2, 4, 1, 5. Write a program for general values of X and N. Ask a user for the number of people and number of passes To speed up the input and debugging, you may wish to store the names of the people in a file. Make sure no two names start the same letter ( Alex and Ana are not OK). Alternatively, you can number the players. Output number and/or the name of a person being eliminated Output number and the name of the winner Do not expect a user to do the right thing, error check the user input; among other things, what do you think a reasonable…arrow_forwardA group of people, numbered 1 to N, are sitting in a circle. Starting at person 1, a hot potato is passed. After x number of passes, the person holding the hot potato is eliminated, the circle closes ranks, and the game continues with the person who was sitting after the eliminated person picking up the hot potato. The last remaining person wins. For example: number of passes = 1 and number of players = 5, the order of elimination is 2, 4, 1, 5. Write a program for general values of X and N. Ask a user for the number of people and number of passes To speed up the input and debugging, you may wish to store the names of the people in a file. Make sure no two names start the same letter ( Alex and Ana are not OK). Alternatively, you can number the players. Output number and/or the name of a person being eliminated Output number and the name of the winner Do not expect a user to do the right thing, error check the user input; among other things, what do you think a reasonable…arrow_forwardSuppose you save $100 each month in a savings account with annual interest rate 3.75%. Thus, the monthly interest rate is 0.0375/12 = 0.003125. After the first month, the value in the account becomes 100 * (1 + 0.003125) = 100.3125, after the second month, the value in the account becomes (100 + 100.3125) * (1 + 0.003125) = 200.938, after the third month, the value in the account becomes (100 + 200.938) * (1 + 0.003125) = 301.878 and so on. Write a Java program that prompts the user to enter a monthly saving amount and displays the account value after the sixth month. (You will use a loop to simplify the code and display the account value for any month.) Sample Output:Enter the monthly saving amount: 100After the first month, the account value is 100.3125After the second month, the account value is 200.9384765625After the third month, the account value is 301.8789093017578Note: The computation should be until 12 months.arrow_forward
- The interest paid on a savings account is compounded daily. This means that if you start with startbal dollars in the bank, at the end of the first day you’ll have a balance ofstartbal * (1 + rate/365)dollars, where rate is the annual interest rate (0.10 if the annual rate is 10 percent). At the end of the second day, you’ll havestartbal * (1 + rate/365) * (1 + rate/365)dollars, and at the end of n days you’ll havestartbal * (1 + rate/365)ndollars. Write a program that processes a set of data records, each of which contains values for rate, startbal, and n and computes the final account balance.arrow_forwardIn Java Sound power level is expressed in decibels. A decibel is 10 x log10(picoWatts),where a picoWatt is 10-12 Watts. To determine the acoustical power levelproduced by the combination of two sound sources, we do the following:1. Convert each decibel level into picoWatts, using the formula, picoWatts =10(decibels / 10)2. Add the picoWatt powers.3. Convert the sum back into decibels.Using good style, create a class called Decibels. In the main method, declare twocomponent decibel values, dB1 and dB1, both double variables. Also declare acombined decibel value, combinedDB. Prompt for and input the two componentdecibel values. Then use the above formulas and Math’s pow method and Math’slog10 method to compute the combined sound power level. Enter first decibel level: 63Enter second decibel level: 65Combination decibel level = 67.1244260279434 dBimport java.util.Scanner;public class Decibels{ public static void main(String[] args) { Scanner stdIn = new Scanner(System.in); double dB1,…arrow_forwardYou will be given a square chess board with one queen and a number of obstacles placed on it. Determine how many squares the queen can attack. A queen is standing on an chessboard. The chess board's rows are numbered from to , going from bottom to top. Its columns are numbered from to , going from left to right. Each square is referenced by a tuple, , describing the row, , and column, , where the square is located. The queen is standing at position . In a single move, she can attack any square in any of the eight directions (left, right, up, down, and the four diagonals). In the diagram below, the green circles denote all the cells the queen can attack from : There are obstacles on the chessboard, each preventing the queen from attacking any square beyond it on that path. For example, an obstacle at location in the diagram above prevents the queen from attacking cells , , and : Given the queen's position and the locations of all the obstacles, find and print the number of…arrow_forward
- In city street grids, intersections are often defined by two integers, counting the position of horizontal and vertical streets (sometimes called streets and avenues). Imagine traveling from position (h1, v1) to (h2, v2). How many blocks do you traverse?arrow_forwardA geometric sequence is a sequence of numbers where each term after the first isfound by multiplying the previous one by a fixed, non -zero number calledthe common ratio. For example, the sequences2, 6, 18, ....3,15,75, ….are a geometric sequences with common ratios 3 and 5 respectively. A geometricsequence is generally characterized by three numbers, the first term ‘a’, thecommon ratio ‘r’ and the number of terms ‘n’. A geometric series is the sum ofnumbers in a geometric sequence. 2+6+18 and 3+15+75 are examples of geometricseries with three terms each.The nth term of a geometric series with initial value ‘a’ and common ratio ‘r’ isgiven by: ?? = ???-1. While the sum of a geometric series is given by:?(1 - ??)1 - ?Create a class GeometricSeries to model a Geometric series. Using friend function,overload the ‘~’ operator to find the nth term of the series. Likewise, overload the‘!’ operator (using a friend function) to find the sum of a Geometric series.Provide a function display() in…arrow_forwardWrite a program that will compute for depreciation. The straight line formula for computing depreciation is given by the following: D = (F – S)/N Where D = depreciation F = Face Value S = Salvage Value N = Number of yearsarrow_forward
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning