InputBox/OutputBox Example

Post on 06-Jan-2016

39 views 0 download

description

InputBox/OutputBox Example. Problem: Write a program that will read in an int and a double, write both to an OutputBox and save it to a file. InputBox/OutputBox Example. Problem: Write a program that will: 1. read in a file name and a double 2. write both to an OutputBox - PowerPoint PPT Presentation

Transcript of InputBox/OutputBox Example

InputBox/OutputBox Example

Problem:

Write a program that will read in an int and a double, write both to an OutputBox and save it to a file.

InputBox/OutputBox Example

Problem:

Write a program that will:

1. read in a file name and a double

2. write both to an OutputBox

3. save it to a file.

InputBox/OutputBox Example

public class Example{

}

InputBox/OutputBox Example

public class Example{

public static void main(String[] args){

}}

InputBox/OutputBox Example

public class Example{

public static void main(String[] args){MainWindow display = new MainWindow(“Example Program”);

}}

InputBox/OutputBox Example

public class Example{

public static void main(String[] args){MainWindow display = new MainWindow(“Example Program”);InputBox inBox = new InputBox(display);

}}

InputBox/OutputBox Example

public class Example{

public static void main(String[] args){MainWindow display = new MainWindow(“Example Program”);InputBox inBox = new InputBox(display);int myNumber = inBox.getInteger(“Please Enter an Integer”);

}}

InputBox/OutputBox Example

public class Example{

public static void main(String[] args){MainWindow display = new MainWindow(“Example Program”);InputBox inBox = new InputBox(display);int myInt = inBox.getInteger(“Please Enter an Integer”);double myDouble = inBox.getDouble(“Please Enter a Double”);

}}

InputBox/OutputBox Example

public class Example{

public static void main(String[] args){MainWindow display = new MainWindow(“Example Program”);InputBox inBox = new InputBox(display);int myInt = inBox.getInteger(“Please Enter an Integer”);double myDouble = inBox.getDouble(“Please Enter a Double”);

OutputBox outBox = new OutputBox(display);

}}

InputBox/OutputBox Example

public class Example{

public static void main(String[] args){MainWindow display = new MainWindow(“Example Program”);InputBox inBox = new InputBox(display);int myInt = inBox.getInteger(“Please Enter an Integer”);double myDouble = inBox.getDouble(“Please Enter a Double”);

OutputBox outBox = new OutputBox(display);outBox.print(myInt);

}}

InputBox/OutputBox Example

public class Example{

public static void main(String[] args){MainWindow display = new MainWindow(“Example Program”);InputBox inBox = new InputBox(display);int myInt = inBox.getInteger(“Please Enter an Integer”);double myDouble = inBox.getDouble(“Please Enter a Double”);

OutputBox outBox = new OutputBox(display);outBox.print(myInt);outBox.print(myDouble);

}}

InputBox/OutputBox Example

public class Example{

public static void main(String[] args){MainWindow display = new MainWindow(“Example Program”);InputBox inBox = new InputBox(display);int myInt = inBox.getInteger(“Please Enter an Integer”);double myDouble = inBox.getDouble(“Please Enter a Double”);

OutputBox outBox = new OutputBox(display);outBox.print(myInt);outBox.print(myDouble);outBox.saveToFile(“SavedExample.txt”);}

}