Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Why won't my printwriter output to my file? - I created the printwriter object in main -in each class i made a printwriter variable and
Why won't my printwriter output to my file?
- I created the printwriter object in main
-in each class i made a printwriter variable and constructor
- for every print statement I did a p.println("");
import java.io.*; public class Driver { public static void main(String[] args) throws IOException { int choice; Printwriter pw = new PrintWriter(new FileWriter("csis.txt")); Decimal dec = new Decimal(pw); Binary bin = new Binary (Pw); Hexadecimal hex = new Hexadecimal(pw); menu Menu = new menu(pw); do { Menu.display(); choice = Menu.getSelection(); switch (choice) { case 1: dec.decToBin(); break; case 2: dec.decToHex(); break; case 3: bin.binToDec(); break; case 4: bin.binToHex(); break; case 5: hex.hexToDec(); break; case 6: hex.hexToBin(); break; } while (choice != 7); pw.close(); import java.io.*; import java.util.Scanner; public class Decimal { private int num; private String temp; private String hexa; private Printwriter p; /** * printwriter called * @param p public Decimal(PrintWriter pw) { p = pw; import java.io.*; public class Driver { public static void main(String[] args) throws IOException { int choice; Printwriter pw = new PrintWriter(new FileWriter("csis.txt")); Decimal dec = new Decimal(pw); Binary bin = new Binary (Pw); Hexadecimal hex = new Hexadecimal(pw); menu Menu = new menu(pw); do { Menu.display(); choice = Menu.getSelection(); switch (choice) { case 1: dec.decToBin(); break; case 2: dec.decToHex(); break; case 3: bin.binToDec(); break; case 4: bin.binToHex(); break; case 5: hex.hexToDec(); break; case 6: hex.hexToBin(); break; } while (choice != 7); pw.close(); import java.io.*; import java.util.Scanner; public class Decimal { private int num; private String temp; private String hexa; private Printwriter p; /** * printwriter called * @param p public Decimal(PrintWriter pw) { p = pwStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started