Coding Global Background
Coding Global

Java I/O

Archived 2 years ago
2 messages
2 members
2 years ago
Open in Discord
A
! Ahmed
Verified

Iam really working for two days cannot find any solutuin for this When i use input methods to write into a file ,it write like in the image, I cannot read it back using scanner or different methods, My main goal is to store integers into a file then i can get it back. **put in mind i want to use loops to read all the integers that stored the file** so please if you could help me. ``` public class queueMachine extends ATM { public static void main(String[] args) throws InterruptedException { orderMe(); } static void orderMe() throws InterruptedException { System.out.println("\nPress 1 to enter the queue of the ATM\nPress 2 for more details\n"); int queueMachine = scanner.nextInt(); switch(queueMachine){ case 1: addToQueue(); break; case 2: queueMachineDetails(); break; } } static void addToQueue() throws InterruptedException { back++; mainQueue.add(back); queueMachOrder++; System.out.println("Your number is: "+ back); int customersBeforeYou = mainQueue.size() -1; System.out.println("Number of Customers before you: " + customersBeforeYou); Thread.sleep(1000); orderMe(); } static void removeFromQueue() { System.out.println("Queue removed"); front++; mainQueue.poll(); System.out.println("reamining customers: "+ mainQueue.size()); } static void queueMachineDetails() throws InterruptedException { System.out.println("\n\nThis is the Queue Machine\nIf you want to use our ATM"); orderMe(); } public static int getFront() { return front; } public static void setFront(int front) { queueMachine.front = front; } public static int getBack() { return back; } public static void setBack(int back) { queueMachine.back = back; } } ```java

Java I/O

Replies (2)