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

/* ELEN 1301-48F Programming Assignment #12 Name : Your name Student ID : Your s

ID: 3690973 • Letter: #

Question

/* ELEN 1301-48F Programming Assignment #12 Name : Your name Student ID : Your student ID# Due date : Objective of this assignment : Read a 8 digits number from the input file. Separate it into 8 single digit numbers. Store those 8 single digit numbers into the output file. Step 1. Open an input and an output file. Step 2. Read contents (your student ID without L) from the input file. Step 3. Split the student ID (8 digits number) into 8 single digits numbers. (See the output example below.) Step 4. Store the number read from the input file as well as the splitted 8 single digit numbers to the output file. Step 5. Close both input and output files. */

Using library iostream please!!!

Input example:

Output example:

output12.txt:

01 ] input11.txt - Notepad | | File Edit Format iew Help 20957230

Explanation / Answer

package com.app.chegg;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.Scanner;

public class StudentIdExample {
   public static void main(String[] args) throws FileNotFoundException {
       FileInputStream fin=new FileInputStream("C:/Users/MR_DELL/Downloads/input11.txt");
       Scanner scan=new Scanner(fin);
       int num=0;
       while(scan.hasNextInt()){
           num=scan.nextInt();
           System.out.println(num);
       }
       String number = String.valueOf(num);
       for(int i = 0; i < number.length(); i++) {
            int j = Character.digit(number.charAt(i), 10);
            System.out.println("The Number "+(i+1)+": " + j);
       }
   }

}


output :-

20597845
The Number 1: 2
The Number 2: 0
The Number 3: 5
The Number 4: 9
The Number 5: 7
The Number 6: 8
The Number 7: 4
The Number 8: 5