Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program that calculates and prints, the sum and product of all the digits in a floating-point number value read from the keyboard.

Write a program that calculates and prints, the sum and product of all the digits in a floating-point number

Write a program that calculates and prints, the sum and product of all the digits in a floating-point number value read from the keyboard. User should enter the floating-point number having 3-digit Integer and 4-digit fractional parts separated by comma (), e.g., 123,5641 Analyze the sample program output given below; and Implement the program printing in the same format Hint: Use Integer.parseInt() to convert from string to Integer. Sample Output: Enter the real number: 345,2233 Sun of digits: 22 Product of digits: 2160 Question 2 [35 pts] Write a Java program Bakery jave that computes the estimated revenue. First, the program reads the number of croissants, the number of muffins, the number of breads, the number of ples and the number of loafs corresponding to the consumed items per week in a format C/M/B/P/L (the length of each part can vary). Unit price of each item is given in the following table. Croissant Muffin Bread Pie Loaf 5.0 TL 5.0 TL 20 TL 10.0 TL 8.0 TL Enter the real number: 390,1240 Sum of digits: 19 Product of digits: 0. Finally, the program computes the estimated revenue of the bakery per month and per year. Analyze the sample program output given below, and implement the program printing in the same format. Please note that a month is 30 days. Hint: Use Integer.parseInt() to convert from string to integer. Sample Output: Enter Number of Items (C/M/B/P/L):120/100/200/30/10 Croissant: 120 Muffin: 100 Bread: 200 Pie: 30 Loaf: 10 Monthly Revenue: 8057.142857142857 TL Annual Revenue: 98028.57142857142 TL Question 3 [35 pts] Write a program that generates an automatic email password. The program asks user to enter name and sumame as text and year of birth as integer. Then it creates the user's password in the following format Sample Output: The last character of the name in uppercase The last three characters of surname in lowercase The last two digits of the year of birth Name Kirby Surname 1SPINK Year: 1957 PSD:Vink57 Write a program that calculates and prints, the sum and product of all the digits in a floating-point number value read from the keyboard. User should enter the floating-point number having 3-digit Integer and 4-digit fractional parts separated by comma (), e.g., 123,5641 Analyze the sample program output given below; and Implement the program printing in the same format Hint: Use Integer.parseInt() to convert from string to Integer. Sample Output: Enter the real number: 345,2233 Sun of digits: 22 Product of digits: 2160 Question 2 [35 pts] Write a Java program Bakery jave that computes the estimated revenue. First, the program reads the number of croissants, the number of muffins, the number of breads, the number of ples and the number of loafs corresponding to the consumed items per week in a format C/M/B/P/L (the length of each part can vary). Unit price of each item is given in the following table. Croissant Muffin Bread Pie Loaf 5.0 TL 5.0 TL 20 TL 10.0 TL 8.0 TL Enter the real number: 390,1240 Sum of digits: 19 Product of digits: 0. Finally, the program computes the estimated revenue of the bakery per month and per year. Analyze the sample program output given below, and implement the program printing in the same format. Please note that a month is 30 days. Hint: Use Integer.parseInt() to convert from string to integer. Sample Output: Enter Number of Items (C/M/B/P/L):120/100/200/30/10 Croissant: 120 Muffin: 100 Bread: 200 Pie: 30 Loaf: 10 Monthly Revenue: 8057.142857142857 TL Annual Revenue: 98028.57142857142 TL Question 3 [35 pts] Write a program that generates an automatic email password. The program asks user to enter name and sumame as text and year of birth as integer. Then it creates the user's password in the following format Sample Output: The last character of the name in uppercase The last three characters of surname in lowercase The last two digits of the year of birth Name Kirby Surname 1SPINK Year: 1957 PSD:Vink57

Step by Step Solution

There are 3 Steps involved in it

Step: 1

Program import javautil public class Calculation public static void mainString args Scanner sc new ScannerSystemin SystemoutprintEnter the real number String valuescnextLine input the real number from ... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Visual C# How to Program

Authors: Paul J. Deitel, Harvey Deitel

6th edition

134601548, 134601793, 978-0134601540

More Books

Students also viewed these Computer Network questions