Question: Lab 4-Loop and Files During this lab, students will learn how to Declare variables and select the appropriate data type Read from and Write into
Lab 4-Loop and Files During this lab, students will learn how to Declare variables and select the appropriate data type Read from and Write into a teat ile Apply loops for repeating processes Test the program to validate the logic. Introduction: a) In lab 4 you will implement the following Write a program in Java that Task 1: Ask the user to input a positive number N. Keep going asking a positive number if the number entered by the user is not positive. Task 2:Create N random numbers (positive integers) in a loop and save them in a text file called Numbers.txt. Task 3: For each number in Numbers.txt print the same number ofsymbols (on the same line) into an output file called Histegram.txt. The following shows an example of run. Important your program should run for any number (integer) provided by the user not only the scenario below. Example: Task 1: Please enter a positive number Task 21 Numbers.txt (fle Numbers.txt is created with 5 numbers. In the example 7. 2. 5. 10 and 20 are generated 10 20 Task 3: Histogram.txt (file showing the numbers of stars associated to each number from Numbera.xt Tasks 1-3 Word document (with pseudo code and Numbers.tat and Histogram.bxt files Java source code (comments, naming convention etc)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
