Using repetition structures. Using decision making Using /0 files. se#1: Counting Number of Digits a Java program that inputs one integer number from the user, determine the number af individual di mber of digits and the digits separated from one another by a tab space. For example, if the user types the program should print "There are 5 digits, which are 4 2 339", le Input/Output Enter an integer value: 12345678 There are (6)diaite, wrich a re(1)2 3 4 5 67 6 num/13 rcise#2: Sales ail-order house sells five products whose retail prices are as follows: Pracuct 1. $2.98; producL duct 3, 5.48, pecduct 4, $4.99 and prod:ict 5. $6.87. Write a Java program that reads as pliows pruduct number and produ et name. The quantity sold is generated at randam between O and 50. Y Lild an a switch statement to deterrnine the retail : rice for each product. It should calculate and display the rsl all praducts sold as srown in the sa mple autaut. The loop should stop laoping when there is no in Dut. ed in an inout file. aple Input file (call it sales.tx 1 Pei * l'encal e 3 A4 paper pask

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Date:
Lab Objectives
This lab was designed to reinforce the following programming concepts:
Using repetition structures.
Using decision making
Using /0 files.
Exercise#1: Counting Number of Digits
Write a Java program that inputs one integer number from the user, determine the number af individual digits and prin
the number of digits and the digits separated from one another by a tab space. For example, if the user types in the numbe
42339, the program should print "There are 5 digits, which are 4 2339",
Sample Input/Output
Enter an integer value: 12345678
There are(8 aigite, wrich are(1)2 3 45676
num/13
Exercise#2: Sales
A mal-order house sells five products whose retail arices are as follows: Procuct 1. $2. sa; product 2, 54.50;
product 3, 34. 481 Eroduct 4. $4.99 and product 5. $6.87. Write a Java program that reads a series of pairs
as foliows: product number and product name. The quantity sold is generated at randam between O and 50. Your program
should n a svitch statem.ent to deternine the retail price for each product. It should calculate and display the total retall
vair ol af praducts sold as shown in the sample auraut. The loop should stop laoping when there is no inout. The input is
stared in an inout file.
Sample Input file (call it sales.tx|
1 PEL
2 lenaal e
3 A4 Faper pask
* Stapler
E Colorin book
Sample Output
Product 1:
P:oduct :
Pニcduct 3:
Penail case
A4 paper pack
tapier
Cnlaring Ecok
45 3279.3z
21 4416.5O
Prccuct 4:
Preducl S
Total ta les: sz06S 40
1/1
Transcribed Image Text:Date: Lab Objectives This lab was designed to reinforce the following programming concepts: Using repetition structures. Using decision making Using /0 files. Exercise#1: Counting Number of Digits Write a Java program that inputs one integer number from the user, determine the number af individual digits and prin the number of digits and the digits separated from one another by a tab space. For example, if the user types in the numbe 42339, the program should print "There are 5 digits, which are 4 2339", Sample Input/Output Enter an integer value: 12345678 There are(8 aigite, wrich are(1)2 3 45676 num/13 Exercise#2: Sales A mal-order house sells five products whose retail arices are as follows: Procuct 1. $2. sa; product 2, 54.50; product 3, 34. 481 Eroduct 4. $4.99 and product 5. $6.87. Write a Java program that reads a series of pairs as foliows: product number and product name. The quantity sold is generated at randam between O and 50. Your program should n a svitch statem.ent to deternine the retail price for each product. It should calculate and display the total retall vair ol af praducts sold as shown in the sample auraut. The loop should stop laoping when there is no inout. The input is stared in an inout file. Sample Input file (call it sales.tx| 1 PEL 2 lenaal e 3 A4 Faper pask * Stapler E Colorin book Sample Output Product 1: P:oduct : Pニcduct 3: Penail case A4 paper pack tapier Cnlaring Ecok 45 3279.3z 21 4416.5O Prccuct 4: Preducl S Total ta les: sz06S 40 1/1
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY