0

I have to write a program but I have no idea where to start. Can anyone help me with an outline of how I should go about it? please excuse my novice level at programming. I have provided the input and output of the program.

The trouble that I'm facing is how do I handle the input text? How should I store the input text to extract the data that I need to produce the output commands? Any guidance would be so helpful.

A little explanation of the input:

  • The output will start with APPLE1: CT= (whatever number is there for CT in line 4)
  • The following lines of the output will begin with "APPLES:"
  • I must include and extract the values for CR, PLANTING and RW in the output.
  • Wherever there is a non-zero or not null in the DATA portion, it will appear in the output.
  • When the program reads END, "APP;APPLER:CT=(whatever number);" will be the last two commands

INPUT:

<apple:ct=12;
FARM DATA
INPUT DATA
CT    CH   CR       PLANTING            RW   DATA
12    YES  PG -0    FA=1 R=CODE1        MM2  COA  COB  CI    COC  COD
                                             0         0     1    0
                                             COE  RN  COF   COG COH
                                             4    00  0
                                             COI   COJ  D
                                             0
                    FA=2 R=CODE2       112  COA  COB  CI    COC  COD
                                             0         0     0    0
                                             COE  RN  COF   COG COH
                                             4    00  0
                                             COI   COJ  D
                                             7

END

OUPUT:

APPLE1:CT=12;  
APPLES:CR=PG-0,FA=1,R=CODE1,RW=MM2,COC=1,COE=4;
APPLES:FA=2,R=CODE2,RW=112,COE=4,COI=7;
APP;
APPLER:CT=12;
Star28
  • 11
  • 3
  • Your input/output explanation is extremely confusing. – Spectric Oct 06 '20 at 23:55
  • If your INPUT's whitespace is spacebar and all elements are in fixed location, try to refer this https://stackoverflow.com/questions/1609807/parsing-a-fixed-width-formatted-file-in-java – Hello world Oct 07 '20 at 00:25
  • Is the data within the input data file laid out **exactly** as you've shown? It would be a good idea to explain what each line means within the input data file. What is ``) bracket somewhere? – DevilsHnd - 退職した Oct 07 '20 at 01:39
  • You could read file line by line and then for each line you can ue substring where you can pass your column index, using this way you can read any value from any line and any column – Vasif Oct 14 '20 at 12:43

0 Answers0