Answered step by step
Verified Expert Solution
Link Copied!

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("");

image text in transcribedimage text in transcribed

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 = pw

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Analytics And Quality Management Fundamental Tools

Authors: Joseph Nguyen

1st Edition

B0CNGG3Y2W, 979-8862833232

More Books

Students also viewed these Databases questions

Question

1. Describe the types of power that effective leaders employ

Answered: 1 week ago