Answered step by step
Verified Expert Solution
Question
1 Approved Answer
For this problem you will read a file of numbers adding them as you go, but skipping some of the number as indicated by a
For this problem you will read a file of numbers adding them as you go, but skipping some of the number as indicated by a code in the file 1. Create a package named prob1 2. Create a text file named numbers.txt in your prob1 folder with the sample values shown below. The third line is the letter "s" followed by the number "2". Similarly, the ninth line is the letter "s" followed by the number "1". This will be explained next. S2 99 17 S1 10 100 Note: You do not need to write a program to create this text file. You m create the file manual creatin ur local disk, and then co and paste all the values above into it it on 3. Create a class named NumberAdder that has a main that reads numbers.txt and adds a numbers except the ones skipped as indicated by a line in the file that starts with the letter "s" and is followed by the number of lines to skip. Finally, the sum should be printed to the console. For example, the input below
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started