Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I have to process an input file to create cube and this is the Specification for

ID: 3552839 • Letter: I

Question

I have to process an input file to create cube and this is the

Specification for input file: (my professor said he's going to generally give us an input similar to this, my program just needs to be able to read in his input file)

Where x Orientation = {G, B, W, O, Y, R}

The File will be in this format (following 26 lines):

WGO, X

OG, X

OGY, X

WG, X

G, X

YG, X

WRG, X

RG, X

YGR, X

WO, X

O, X

OY, X

W, X

Y, X

WR, X

R, X

YR, X

BWO, X

BO, X

BOY, X

BW, X

B, X

BY, X

BRW, X

BR, X

BYR, X


I have done most of the work, but I can't figure out how to implement the main method part to actually run and see if it works. Provide your e-mail so I can send my java files because its too much here. Please help!!

Explanation / Answer

To just read the file you can do the below code. The split is there because sure you'll need to do something with the line data.

The line 'Where x Orientation = {G, B, W, O, Y, R}' in question

doesn't make any sense, if you could explain a bit, maybe I can help you further.


import java.io.File;

import java.io.IOException;

import java.util.Scanner;



public class Cube {


public static void main(String[] args) throws IOException {

Scanner in = new Scanner(new File("inputfile.txt"));

String line;

while(in.hasNextLine()){

line = in.nextLine();

String[] lineSplit = line.split(",");


}

}


}