Concept explainers
Write an application that estimates the value of the mathematical constant e by using the following formula. Allow the user to enter the number of terms to calculate.
Want to see the full answer?
Check out a sample textbook solutionChapter 4 Solutions
Java How To Program (Early Objects) (10th Edition)
Additional Engineering Textbook Solutions
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
Computer Systems: A Programmer's Perspective (3rd Edition)
Starting Out with Python (3rd Edition)
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
Starting Out with C++: Early Objects (9th Edition)
Software Engineering (10th Edition)
- Write an application that asks the user to enter two integers and displays "The two numbers you entered are: ", followed by the larger integer.arrow_forwardUsing Flowgorithm, create an application that reads two integers, determines whether the first is a multiple of the second and prints the result. [Hint:arrow_forwardcreate an application that will find the largest and the smallest number of a series of integers input by the user. Assume that the user will input only integers that are between -100 and 100 (both inclusive) (no need to validate the input). When the user inputs 101, the application should output the smallest and the largest number.arrow_forward
- Suppose you want to deposit a certain amount of money into a savings account with a fixed annual interest rate. What amount do you need to deposit in order to have $5,000 in the account after three years? The initial deposit amount can be obtained using the following formula: initialDepositAmount = finalAccountValue/ (1 + monthlyInterestRate)numberOfMonths Write a program that prompts the user to enter final account value, annual interest rate in percent, and the number of years, and displays the initial deposit amount.arrow_forwardThe following table shows the approximate speed of sound in air, water, and steel: Write a program that asks the user to enter “air”, “water”, or “steel” and the distance that a sound wave will travel in the medium. The program should then display the amount of time it will take. You can calculate the amount of time it takes sound to travel in air with the following formula: Time = Distance / 1,100 You can calculate the amount of time it takes sound to travel in water with the following formula: Time = Distance / 4,900 You can calculate the amount of time it takes sound to travel in steel with the following formula: Time = Distance / 16,400arrow_forwardPlease add commentsarrow_forward
- A complex number is a number in the form a + bi, where a and b are real numbers and i is sqrt( -1). The numbers a and b are known as the real part and imaginary part of the complex number, respectively.You can perform addition, subtraction, multiplication, and division for complex numbers using the following formulas:a + bi + c + di = (a + c) + (b + d)ia + bi - (c + di) = (a - c) + (b - d)i(a + bi) * (c + di) = (ac - bd) + (bc + ad)i(a+bi)/(c+di) = (ac+bd)/(c^2 +d^2) + (bc-ad)i/(c^2 +d^2)You can also obtain the absolute value for a complex number using the following formula:| a + bi | = sqrt(a^2 + b^2)(A complex number can be interpreted as a point on a plane by identifying the (a, b) values as the coordinates of the point. The absolute value of the complex number corresponds to the distance of the point to the origin, as shown in Figure 13.10.)Design a class named Complex for representing complex numbers and the methods add, subtract, multiply, divide, and abs for performing complex…arrow_forwardPLEASE USE FLOWGORITHM DOES NOT HAVE TO BE COMPLEX In Chapter 2 you learned that in many programming languages you can generate a random number between 1 and a limiting value named LIMIT by using a statement similar to randomNumber = random(LIMIT). Using Flowgorithm create the logic for a guessing game in which the application generates a random number and the player tries to guess it. Display a message indicating whether the player's guess was correct, too high, or too low. Allow the user to guess three times. Please post the Flowgorithm file. I need the file!!arrow_forwardEvaluate each of the following expressions. Assume the following: int a = 3, b = 7; float x = 6.0, y = 3.1 z = 2.0 (int)y * 10 + barrow_forward
- Calculator: Initially asks for two numbers. Afterwards, ask the user to select the operator and perform the calculation. Ask the user if a new calculation for two numbers is needed, or a computation for the previous number will be required. Test case 1: Ener two numbers : 15 25 Ener an operator (+, -, / ,-) :+ : 40 Output: Do you want to continue, exit or compute two numbers? (con, exit, com] exit Test case 2: Ener two numbers : 11.50 6 Ener an operator (+, -, /,-) :- Output: :5.50 Do you want to continue, exit or compute another two numbers? (con, exit, com] con Enter another number : 25 Ener an operator (+, -, 7,-) Output: Do you want to continue, exit or compute another two numbers? [con, exit, com] exit :137.50 Test case 3: Ener two numbers :23.50 14 Ener an operator [+, -, /,-1 :/ Output: Do you want to continue, exit or compute another two numbers? [con, exit, com] com :1.68 Ener two numbers : 14 Ener an operator (+, -, /,-) :+ Output: : Missing number Ener two numbers :14 15…arrow_forwardThe two roots of a quadratic equationax2 + bx + c = 0 can be obtained using the following formula:b2 - 4ac is called the discriminant of the quadratic equation. If it is positive, theequation has two real roots. If it is zero, the equation has one root. If it is negative,the equation has no real roots.Write a program that prompts the user to enter values for a, b, and c and displaysthe result based on the discriminant. If the discriminant is positive, display tworoots. If the discriminant is 0, display one root. Otherwise, display “The equationhas no real roots.”Note you can use Math.pow(x, 0.5) to compute √x. Here are some sampleruns: Enter a, b, c: 1.0 3 1 ↵EnterThe equation has two roots -0.381966 and -2.61803arrow_forwardCreate a flowchart for the following scenario Given a positive integer N >1, write a flowchart that determines if N is a prime number or a constant number. Hint: You can use the % operator (A % B), which computes the remainder of A/B.arrow_forward
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTProgramming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage LearningC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
- Programming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageEBK JAVA PROGRAMMINGComputer ScienceISBN:9781305480537Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,