1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
solmaris [256]
3 years ago
10

1. Copy the file Pay.java (see Code Listing 1.1) from the Student CD or as directed by your instructor. 2. Open the file in your

Java Integrated Development Environment (IDE) or a text editor as directed by your instructor. Examine the file, and compare it with the detailed version of the pseudocode in step number 3, section 1.6 of the textbook. Notice that the pseudocode does not include every line of code. The program code includes identifier declarations and a statement that is needed to enable Java to read from the keyboard. These are not part of actually completing the task of calculating pay, so they are not included in the pseudocode. The only important difference between the example pseudocode and the Java code is in the calculation. Below is the detailed pseudocode from the example, but without the calculation part. You need to fill in lines that tell in English what the calculation part of Pay.java is doing.
Engineering
1 answer:
Mrac [35]3 years ago
5 0

Answer:

Code Listing 1.1 (Pay.java)

import java.util.Scanner; // Needed for the Scanner class

/**

This program calculates the user's gross pay.

*/

public class Pay

{

public static void main(String[] args)

{

// Create a Scanner object to read from the keyboard. Scanner keyboard = new Scanner(System.in);

// Identifier declarations

double hours; // Number of hours worked

double rate; // Hourly pay rate double pay; // Gross pay

// Display prompts and get input. System.out.print("How many hours did you work? "); hours = keyboard.nextDouble();

System.out.print("How much are you paid per hour? ");

rate = keyboard.nextDouble();

// Perform the calculations. if(hours <= 40)

pay = hours * rate;

else

pay = (hours - 40) * (1.5 * rate) + 40 * rate;

// Display results. System.out.println("You earned $" + pay);

}

}

Code Listing 1.2 (SalesTax.java)

import java.util.Scanner; // Needed for the Scanner class

/**

This program calculates the total price which includes

sales tax.

*/

public class SalesTax

{

public static void main(String[] args)

{

// Identifier declarations final double TAX_RATE = 0.055; double price;

double tax

double total; String item;

// Create a Scanner object to read from the keyboard. Scanner keyboard = new Scanner(System.in);

// Display prompts and get input. System.out.print("Item description: "); item = keyboard.nextLine(); System.out.print("Item price: $");

price = keyboard.nextDouble();

// Perform the calculations. tax = price + TAX_RATE;

totl = price * tax;

// Display the results. System.out.print(item + "  $"); System.out.println(price); System.out.print("Tax $"); System.out.println(tax); System.out.print("Total $"); System.out.println(total);

}

}

You might be interested in
A horizontal 2-m-diameter conduit is half filled with a liquid (SG=1.6 ) and is capped at both ends with plane vertical surfaces
luda_lava [24]

Answer:

Resultant force = 639 kN and it acts at 0.99m from the bottom of the conduit

Explanation:

The pressure is given as 200 KPa and the specific gravity of the liquid is 1.6.

The resultant force acting on the vertical plate, Ft, is equivalent to the sum of the resultant force as a result of pressurized air and resultant force due to oil, which will be taken as F1 and F2 respectively.

Therefore,

Ft = F1 + F2

According to Pascal's law which states that a change in pressure at any point in a confined incompressible fluid is transmitted throughout the fluid such that the same change occurs everywhere, the air pressure will act on the whole cap surface.

To get F1,

F1 = p x A

= p x (πr²)

Substituting values,

F1 = 200 x π x 1²

F1 = 628.32 kN

This resultant force acts at the center of the plate.

To get F2,

F2 = Π x hc x A

F2 = Π x (4r/3π) x (πr²/2)

Π - weight density of oil,

A - area on which oil pressure is acting,

hc - the distance between the axis of the conduit and the centroid of the semicircular area

Π = Specific gravity x 9.81 x 1000

Therefore

F2 = 1.6 x 9.81 x 1000 x (4(1)/3π) x (π(1)²/2)

F2 = 10.464 kN

Ft = F1 + F2

Ft = 628.32 + 10.464

Ft = 638.784 kN

The resultant force on the surface is 639 kN

Taking moments of the forces F1 and F2 about the centre,

Mo = Ft x y

Ft x y = (F1 x r) + F2(1 - 4r/3π)

Making y the subject,

y = (628.32 + 10.464(1 - 4/3π)/ 638.784

y = 0.993m

7 0
3 years ago
The following displacement (cm), output (V) data have been recorded during a calibration of an LVDT. Displacement (cm), output (
nadya68 [22]

Answer:

2.08V/cm

Explanation:

Plot the points on a graph. Draw the line of best fit. Calculate the gradietn of line of best fit.

Attached is the graph plotted on excel.

The equation of the line is

Votlage= 2.08× distance + 0.276

4 0
3 years ago
Two loads connected in parallel draw a total of 2.4 kW at 0.8 pf lagging from a 120-V rms, 60-Hz line. One load absorbs 1.5 kW a
stealth61 [152]

Answer: a) 0.948 b) 117.5µf

Explanation:

Given the load, a total of 2.4kw and 0.8pf

V= 120V, 60 Hz

P= 2.4 kw, cos θ= 80

P= S sin θ - (p/cos θ) sin θ

= P tan θ(cos^-1 (0.8)

=2.4 tan(36.87)= 1.8KVAR

S= 2.4 + j1. 8KVA

1 load absorbs 1.5 kW at 0.707 pf lagging

P= 1.5 kW, cos θ= 0.707 and θ=45 degree

Q= Ptan θ= tan 45°

Q=P=1.5kw

S1= 1.5 +1.5j KVA

S1 + S2= S

2.4+j1.8= 1.5+1.5j + S2

S2= 0.9 + 0.3j KVA

S2= 0.949= 18.43 °

Pf= cos(18.43°) = 0.948

b.) pf to 0.9, a capacitor is needed.

Pf = 0.9

Cos θ= 0.9

θ= 25.84 °

(WC) V^2= P (tan θ1 - tan θ2)

C= 2400 ( tan (36. 87°) - tan (25.84°)) /2 πf × 120^2

f=60, π=22/7

C= 117.5µf

7 0
3 years ago
Homes may be heated by pumping hot water through radiators. What mass of water (in g) will provide the same amount of heat when
Nitella [24]

Answer:

a mass of water required is mw= 1273.26 gr = 1.27376 Kg

Explanation:

Assuming that the steam also gives out latent heat, the heat provided should be same for cooling the hot water than cooling the steam and condense it completely:

Q = mw * cw * ΔTw = ms * cs * ΔTw + ms * L

where m = mass , c= specific heat , ΔT=temperature change, L = latent heat of condensation

therefore

mw = ( ms * cs * ΔTw + ms * L )/ (cw * ΔTw )

replacing values

mw = [182g * 2.078 J/g°C*(118°C-100°C) + 118 g * 2260 J/g ] /[4.187 J/g°C * (90.7°C-39.4°C)] = 1273.26 gr = 1.27376 Kg

3 0
3 years ago
It is known that the connecting rod AB exerts on the crank BCa 2.5-kN force directed down andto the left along the centerline of
monitta

Answer:

M_c = 61.6 Nm

Explanation:

Given:

F_a = 2.5 KN

Find:

Determine the moment of this force about C for the two casesshown.

Solution:

- Draw horizontal and vertical vectors at point A.

- Take moments about point C as follows:

                         M_c = F_a*( 42 / 150 ) *88

                         M_c = 2.5*( 42 / 150 ) *88

                         M_c = 61.6 Nm

- We see that the vertical component of force at point A passes through C.

Hence, its moment about C is zero.

6 0
3 years ago
Other questions:
  • A pressure gage connected to a tank reads 50 psi at a location where the barometric reading is 29.1 inches Hg. Determine the abs
    6·1 answer
  • How does running an electric current through wire cause a magnetic field?
    6·1 answer
  • Consider laminar, fully developed flow in a channel of constant surface temperature Ts. For a given mass flow rate and channel l
    15·1 answer
  • Consider a drainage basin having 60% soil group A and 40% soil group B. Five years ago the land use pattern in the basin was ½ w
    12·1 answer
  • A cylindrical tank with a radius of 2-m is filled with oil and water. The water has a density of rho = 1000 kg/m3 while the oil
    6·1 answer
  • Define ways in which you would go about networking to explore opportunities in your career field and obtain more information for
    11·1 answer
  • What have you learned from the previous lesson? Let's try to check your prior knowledge
    9·1 answer
  • How to change a fuel fiter
    12·1 answer
  • Anything you want to do in Hootsuite can be found in the ________, with the main workspace in the _________?
    15·1 answer
  • When did michael faraday invent wind powered electrical generation?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!