Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Okay, so I'm trying to figure out a lab for my cpsc 1060 class. I'm supposed to program the code to create the output that's

Okay, so I'm trying to figure out a lab for my cpsc 1060 class. I'm supposed to program the code to create the output that's in the photo. The problem is that I'm completely lost on how to program this correctly. The instructions given are way too vague for a beginner like me to understand, and when I ask for help I'm left with way more questions than answers. Could you walk me through the process step by step so I know what I need to do, or at least dumb things down for me? (I've asked this before, but his time i'm giving 2 specific files my teacher just suggested i use instead (one of them is the string that I'm supposed to use...i guess?). Sadly, I still didn't understand when he explained certain things, so I thought it'd be best if I asked the experts again!)

image text in transcribedimage text in transcribedimage text in transcribed
StringManipulator - Notepad X File Edit Format View Help import java. util. Scanner; public class StringManipulator{ public static void main (String args) { Scanner sc = new Scanner (System. in) ; String line = ""; int numofLines = 0; int filelength = 0; / / # of chars in the file String firstword = ""; line = sc. nextLine( ); // read input until you see the word "End" while (!line. equals("End") ) { // calculate the length of the line // get the first word and print it. // use Sting methods shown in Ch.5 of textbook // and figure out how to do it using those methods. // Then convert it to lower case. Print out. / / keep track of how many lines you read line = sc. nextLine( ); // print number of characters in the file // print number of lines in the file } / / end main Ln 8, Col 59 100% Unix (LF) UTF-8 Type here to search OF ABROMNOO V_/home/kluchey/cpsc1060/lab4/file (3).in - kluchey@access.computing.clemson.edu - Editor - WinSCP X HexanchEncoding . Color I shot an Arrow into the air It fell to earth I knew not where, For so swiftly it flew, the sight Could not follow it in its flight. I breath'd a Song into the air It fell to earth, I knew not where. For who has sight so keen and strong That it can follow the flight of a song? Long, long afterward in an oak I found the Arrow still unbroke; And the Song from begining to end I found again in the heart of a friend. End Line: 1/13 Column: 1 Character: 73 (0x49) Encoding: 1252 (ANSI - La Type here to search O CABROMNOO@ncic X 10983 x 5 Tonga X 5 Laws X > Alask X G tlingit x Alask: X CPSC X iRoar X Lab4 X CPSC X + X - - C D @ File | C:/Users/texti/Downloads/CPSC%201060%20lab4%20Fall%202020p%20(1).pdf Output: access.computing.clemson.edu - PUTTY [15: 48: 48] saracho@babbagell : ~/Java [207] The first word is: i The first word is: i The first word is: for The first word is: could The first word is: i The first word is: it The first word is: for The first word is: that The first word is: long, The first word is: i The first word is: and The first word is: i Number of characters in the file: 404 Number of lines in the file: 12 [15 : 48:51] saracho@babbagell : ~/Java [208] Type here to search OF ABROM NA 9 11:48 AM 9/22/2020

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions