Big Java Late Objects
2nd Edition
ISBN: 9781119330455
Author: Horstmann
Publisher: WILEY
expand_more
expand_more
format_list_bulleted
Question
Chapter 2, Problem 12PP
Program Plan Intro
Print source voltage
Program plan:
- Import the required package.
- Create a class “Voltage”,
- Define “main()” function,
- Create an object for “Scanner” class to get the input from the user.
- Initialize the required variables.
- Get the power factor “p_f” from the user using “next()” method.
- Calculate the source voltage using the given formula.
- Print the source voltage as output.
- Define “main()” function,
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Q. Figure below depicts a part of a factory that makes bubble gumballs. The gumballs
travel on a conveyor that has three associated sensors s1, S2, and s3. The sensor s, is
connected to a scale that weighs each gumball, and if a gumball is not heavy enough to
be acceptable then the sensor sets s1
each gumball. If a gumball is too small to be acceptable, then s2 = 1, and if it is too
large, then s3 = 1. If a gumball is of an acceptable weight and size, then the sensors
give s1 = s2 = S3 = 0. The conveyor pushes the gumballs over a “trap door" that it
used to reject the ones that are not properly formed. A gumball should be rejected if it
is too large, or both too small and too light. The trap door is opened by setting the
logic function f to the value 1.
= 1. Sensors s2 and s3 examine the diameter of
S2
gumball
A. PAL realization.
B. FPGA with VHDL code.
f = "reject"
Electrical Engineering Department/ University of Basrah
There are 102 towers, including terminal towers, in a transmission line. The spacing (in meters) between all towers is evident. Tension towers and angle towers type towers numbered 8, 15, 20, 28, 37, 46, 58, 65, 74, 87, 93 from the beginning of the line. Write the computer program that will calculate all the ruling openings in this transmission line and draw the flow diagram.
A company has several employees, all with different names, who perform interviews with
job applicants (one applicant is interviewed by one employee). The job applicants also have
different names. The interviewer makes appointments for interviews with the applicants.
Each applicant may be interviewed at several occasions, possibly by different interviewers,
but in that case the interviews take place during different days.
The company has special interview rooms. Each interviewer uses the same room for all
interviews during a day. A room may, however, be used by different interviewers during a
day, as long as the interviews don't collide in time.
The reservation of interview appointments is to be computerized. The database devel-
oper has decided to use a single relation for all data, with the following schema:
Interviews(interviewer, applicant, day, time, room)
a) From the text, find functional dependencies in the relation.
b) Find the keys of the relation.
c) Show that the relation is…
Chapter 2 Solutions
Big Java Late Objects
Ch. 2.1 - Declare a variable suitable for holding the number...Ch. 2.1 - What is wrong with the following variable...Ch. 2.1 - Declare and initialize two variables, unitPrice...Ch. 2.1 - Prob. 4SCCh. 2.1 - Some drinks are sold in four-packs instead of...Ch. 2.1 - Prob. 6SCCh. 2.1 - Prob. 7SCCh. 2.1 - Prob. 8SCCh. 2.1 - How would you explain assignment using the parking...Ch. 2.2 - A bank account earns interest once per year. In...
Ch. 2.2 - In Java, how do you compute the side length of a...Ch. 2.2 - The volume of a sphere is given by V=43r3 If the...Ch. 2.2 - Prob. 13SCCh. 2.2 - Prob. 14SCCh. 2.3 - Write statements to prompt for and read the users...Ch. 2.3 - What is wrong with the following statement...Ch. 2.3 - Prob. 17SCCh. 2.3 - What is problematic about the following statement...Ch. 2.3 - What is the output of the following statement...Ch. 2.3 - Using the printf method, print the values of the...Ch. 2.4 - Prob. 21SCCh. 2.4 - Suppose the architect specifies a pattern with...Ch. 2.4 - A robot needs to tile a floor with alternating...Ch. 2.4 - For a particular car, repair and maintenance costs...Ch. 2.4 - The shape of a bottle is approximated by two...Ch. 2.5 - What is the length of the string "Java Program"?Ch. 2.5 - Consider this string variable. String str = "Java...Ch. 2.5 - Use string concatenation to turn the string...Ch. 2.5 - Prob. 29SCCh. 2.5 - Prob. 30SCCh. 2 - Write declarations for storing the following...Ch. 2 - What is the value of mystery after this sequence...Ch. 2 - What is wrong with the following sequence of...Ch. 2 - Write the following mathematical expressions in...Ch. 2 - Write the following Java expressions in...Ch. 2 - What are the values of the following expressions?...Ch. 2 - What are the values of the following expressions,...Ch. 2 - What are the values of the following expressions?...Ch. 2 - Assuming that a and b are variables of type int,...Ch. 2 - Suppose direction is an integer angle between 0...Ch. 2 - Find at least five compile-time errors in the...Ch. 2 - Find three run-time errors in the following...Ch. 2 - Consider the following code segment. double...Ch. 2 - Explain the differences between 2, 2.0, 2, 2, and...Ch. 2 - Explain what each of the following program...Ch. 2 - Write pseudocode for a program that reads a word...Ch. 2 - Write pseudocode for a program that reads a name...Ch. 2 - Write pseudocode for a program that computes the...Ch. 2 - Modify the pseudocode for the program in How To...Ch. 2 - Prob. 20RECh. 2 - You are cutting off a piece of pie like this,...Ch. 2 - The following pseudocode describes how to obtain...Ch. 2 - Suppose you are given a string str and two...Ch. 2 - Prob. 24RECh. 2 - For each of the following computations in Java,...Ch. 2 - Prob. 26RECh. 2 - This chapter contains a number of recommendations...Ch. 2 - Write a program that displays the dimensions of a...Ch. 2 - Write a program that computes and displays the...Ch. 2 - Write a program that reads a number and displays...Ch. 2 - Write a program that prompts the user for two...Ch. 2 - Enhance the output of Exercise E2.4 so that the...Ch. 2 - Write a program that prompts the user for a...Ch. 2 - Write a program that prompts the user for a radius...Ch. 2 - Write a program that asks the user for the lengths...Ch. 2 - Improve the program discussed in How To 2.1 to...Ch. 2 - Write a program that helps a person decide whether...Ch. 2 - Write a program that asks the user to input The...Ch. 2 - File names and extensions. Write a program that...Ch. 2 - Write a program that reads a number between 1,000...Ch. 2 - Write a program that reads a number between 1,000...Ch. 2 - Printing a grid. Write a program that prints the...Ch. 2 - Write a program that reads in an integer and...Ch. 2 - Write a program that reads two times in military...Ch. 2 - Writing large letters. A large letter H can be...Ch. 2 - Write a program that transforms numbers 1, 2, 3, ,...Ch. 2 - Write a program that prints a Christmas tree:...Ch. 2 - Easter Sunday is the first Sunday after the first...Ch. 2 - In this project, you will perform calculations...Ch. 2 - The following pseudocode describes how a bookstore...Ch. 2 - The following pseudocode describes how to turn a...Ch. 2 - The following pseudocode describes how to extract...Ch. 2 - Giving change. Implement a program that directs a...Ch. 2 - An online bank wants you to create a program that...Ch. 2 - A video club wants to reward its best members with...Ch. 2 - Consider the following circuit. Write a program...Ch. 2 - The dew point temperature Td can be calculated...Ch. 2 - The pipe clip temperature sensors shown here are...Ch. 2 - Prob. 12PPCh. 2 - Consider the following tuning circuit connected to...Ch. 2 - According to the Coulomb force law, the electric...
Knowledge Booster
Similar questions
- INTRODUCTION: Heat conduction from a cylindrical solid wall of a pipe can be determined by the follow T1-T2 q = 2nLk R2 In R. where: q is the computed heat conduction in Watts. k is the thermal conductivity of the pipe material in Watts/°C/m. L is the length of the pipe in cm. Ri is the inner radius of the pipe in cm. R2 is the outer radius of the pipe in cm. Ti is the internal temperature in °C. T2 is the external temperature in °C. ASSIGNMENT: Write a C program that will allow the user to enter the inner and outer radii of the pipe, the the internal and external temperatures. Once the user enters the input values, the programarrow_forwardQuestion Harry has a big wall clock, that got hit while he was playing. Now, the minute hand doesn't rotate by the angle 2t/3600 each second, but now it moves according to different angle x. You can assume that coordinates of the centre of the clock are (0, 0) and the length of the minute hand is I. One endpoint of the minute hand is always located at the clock centre; the other endpoint is initially located at the point (0, 1). One second later, Harry observes that this endpoint is at distance d above the x-axis, i.e., the y-coordinate of this endpoint is equal to d. Harry is curious about where the minute hand will be (specifically, its y-coordinate) after t seconds. Because t can be very large, Harry can't wait for that moment. Please help him to write a python code that prints a single line containing the output. Input: 422 Output 4arrow_forwardA nuclear power station has a safety system based on three inputs to a logic circuit (network). A warning signal (S = 1) is produced when certain conditions in the nuclear power station occur based on these three inputs. CREATE THE LOGIC CIRCUIT SHOWING ALL THE POSSIBLE SITUATIONS. INPUTS BINARY VALUE T P W 1 0 1 0 1 0 DESCRIPTION OF PLANT Temperature > 115°C Temperature 15 bar Reactor pressure 120 litres/hour Cooling water <= 120 litres/hourarrow_forward
- A beam with a length L is attached to the wall with a cable as shown. A load W = 400 lb. is attached to the beam. The tension force, T, in the cable is given by: T = WL√h²+x² hx For a beam with L= 120 in. and h = 50 in. calculate T for x = 10, 30, 50, 70, 90, and 110 in. MATLAB D Warrow_forwardDesign a traffic light controller for traffic lights. One street is north-south (NS), and another street is east-west (EW). Yellow time is T, green time is 2T, and red time is 3T (T is any time unit, for example, seconds). Light is R on one side when on the other side is G or Y. Lights order is G-Y-R.For the traffic light, as input (Time) use a clock, and the six outputs are G, Y, and R on each side (use color LEDs or show the time diagram). A) State diagram B) True table C) Circuit diagramarrow_forward1),. Given the following descriptions of FSA, please answer the following questions. Q = {90, 91, 92, 93} I = {a,b} A = {91,92} The transition function is defined below: 8(90, a) = 91 8(92, a) = 92 a. Draw a diagram of this FSA. b. Give a state transition table of this FSA. 8(90, b) = 93 8(92, b) = 93 8(9₁, a) = 91 8(93, a) = 92 8(91, b) = 92 8(93, b) = 93arrow_forward
- Abstract: the main purpose of this experiment is build real time system using PPI 8255 to control devices connected to. Problem description: assume that there are two devices are connected to port A and two sensors are connected to port B of PPI 8255. They work according to the following table Sensors (S1S2) Devices (DID2) 00 01 01 10 10 11 11 00 Write a program to control these two devices according to the values of sensors.arrow_forwardthermostat, which will turn the heat on when the room temperature drops h degrees below its set point, Ts, and cuts heat off at a temperature h degrees higher than Ts . The system heats at a constant rate Q (thermal units per time unit), and the volume of the room is V, so, if the room were perfectly insulated, the heating system would raise the temperature of the room at the rate KVQ (degrees per time unit), where K is a constant of proportionality giving the change in temperature per thermal unit per unit volume. However, there is a heat loss to the outside that is proportional to the difference in temperature between the room and the outside. Using the modified Euler method, write a FORTRAN program to simulate this system, if the room temperature at time is T(t), T(0) = To, and the outside temperature, Tout' is given by: Case (1) : Tout is constant < Ts Case (2) : Tout = A sin(wt + 4)| , %3D reflecting daily cycles. A is temperature range, 2n/w is the period of a cycle, and o is the…arrow_forwardA video frame displayed onscreen consists of many pixels, with eachpixel, or cell, representing one unit of video output. A videodisplay’s resolution is typically specified in horizontal and verticalpixels (such as 1920 3 1080), and the number of pixels onscreen issimply the product of these numbers (1920 3 1080 5 2,073,600 pixels).A pixel’s data content is one or more unsigned integers. For ablack-and-white display, each pixel is a single number (usuallybetween 0 and 255) representing the intensity of the color white.Color pixel data is typically represented as one or three unsignedintegers.When three numbers are used, the numbers are usually between 0 and255, and each number represents the inten- sity of a primary color(red, green, or blue). When a single number is used, it represents apredefined color selected from a table (palette) of colors.Motion video is displayed onscreen by copying frames rapidly to thevideo display controller. Because video images or frames require manybytes…arrow_forward
- A robot is a programmable machine that can carry out a series of automated tasks. The final lab for the semester is to build a robot of your own design. Your robot should contain at least two sensors, and two output mechanisms that work together to perform a task. Sensors can be something like a temperature or light sensor. Output mechanisms can be things like servo motors or lights. In order to make sure that the task your robot performs is sufficiently complex to meet the objectives of the course you will need to write a proposal that answers the questions below.1. Describe the purpose or goal of your robot. Answer the question, “Why does this robot exist?” What problem does it solve? What are some of the challenges to solving that problem?2. Describe how your robot will solve the problem. What sensors will it use? How will it behave based on the inputs and how will it overcome the challenges presented?3. How will you know if your robot successfully meets its goals? What tests will…arrow_forwardThe annual snake festival is upon us and all the snakes of the kingdom have gathered to participate in the parade. The chef was tasked with reporting on the parade, so he decided to watch all the snakes first. When he sees the snake first, it will be his head, so he marks the "H". Snakes are long, and when they see the snake finally scurry away, they mark its tail with a "T". In the interim, when the snake is moving around it, or in the time between one snake and the next snake, it marks a '.'. Since the snakes come in a procession and one by one, a valid message would be something like "..H..T...HTH....T.", or "...", or "HT", while "T ...H..H.T", "H..T..H", "H..H..T..T" would be invalid messages (see explanation below). Formally, a snake is represented by an 'H' followed by some (possibly null) '.' and then 'T'. A valid message is one that begins with the (probably zero-length) string '.' and then some (possibly zero) snakes, with some '.'s in between, and finally some (possibly zero)…arrow_forwardAn analog signal in sine form is intended to be transmitted to the receiver by pulse code modulation.Given below Define the parameters and answer the questions asked from you. *Peak to peak amplitude = xxx volts *Signal frequency = xxx Hz *Medium height form factor: xxx level You will give the value of xxx 1-)What should be the theoretical minimum sampling frequency for the signal to be reconstructed in the receiver without distortion? 2-) What should be the practical minimum sampling frequency for the signal to be recreated in the receiver without distortion? 3-)Before sampling, what should be the theoretical and practical minimum sampling frequency if an anti-aliasing filter is used at the frequency of xxx Hz you specify? 4-)What is the mean square quantization error? 5-)Calculate the maximum quantization error.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Operations Research : Applications and AlgorithmsComputer ScienceISBN:9780534380588Author:Wayne L. WinstonPublisher:Brooks Cole
Operations Research : Applications and Algorithms
Computer Science
ISBN:9780534380588
Author:Wayne L. Winston
Publisher:Brooks Cole