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 (11th Global 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)
- Using 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_forwardGino's Pizzaria wants an application to compute the price of pizza orders, based on the following: If the size/toppings are:�small� with 2 or fewer toppings, charge is $7. �small� with more than 2 toppings, charge is $9. �medium� with 3 or fewer toppings, charge is $12. �medium� with more than 3 toppings, charge is $15. �large� with any number of toppings, charge is $23. Write pseudocode for a program that accepts data for an order:order number size of pizza number of toppings Display the order number and the final price for the pizza. EXAMPLES: If "284, medium, 3" is entered, then display "Order #284 costs $12"If "117, large, 0" is entered, then display "Order #117 costs $23"If "509, small, 6" is entered, then display "Order #509 costs $9"arrow_forward
- Please put comment at each step of the programarrow_forwardSuppose 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_forward
- Please add commentsarrow_forwardBody Mass Index is a simple calculation using a person's height and weight. The formula is BMI = kg/m2 where kg is a person's weight in kilograms and m2 is their height in meters squared. Calculate a persons Body Mass index using their weight in pounds. This means you must first convert pounds to kilograms (kg) then apply the formula above. In converting pounds to kg, 1 pound = 0.453592 kg. So to convert pounds to kg, either multiply the pound value by 0.45359237 or divide by 2.2046226218. Then you must convert their height in inches to meters. The length in meters is equal to the inches multiplied by 0.0254. Write a program that accepts a users height as an integer in inches and their weight in pounds. Convert those inputs to their metric equivalents outlined above and determine their body mass index. Display what the conversions from and to their metric equivalents are. Display the body mass index and the category it belongs to.arrow_forwardWrite a Phyton program that computes the duration of a projectile’s flight and its height above the ground when it reaches the target. As part of your solution, you should display instructions to the program user. Relevant formula: time = distancevelocity xcos (θ) height = velocity xsin x time- g x time22 use the following variables: g = gravitational constant = 32.17 = angle of elevation in radian v = velocity or the projectile velocity (ft/sec) d= distance to target t = time of flight in seconds. h = height at impact Try your program on these data sets.arrow_forward
- Write a program that calculates the future value of an investment at a given interest rate for a specified number of years. The formula for the calculation is: futureValue = investmentAmount * (1 + monthlyInterestRate)years*12 Use text fields for the investment amount, number of years, and annual interest rate. Display the future amount in a text field when the user clicks the Calculate button,arrow_forwardA 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_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,