Question
Java Programming Using Files for Input and Output Write complete Java programs from the instructions and output examples given. 1. a. Critical Thinking Exercise: Design
Java Programming
Using Files for Input and Output
Write complete Java programs from the instructions and output examples given.
1. a. Critical Thinking Exercise: Design a Java program that a small gift shop could use to order mer- chandise. The wholesaler requires that you send your order as a file over the Internet. Create your order file by entering your input through dialog boxes and writing to an output file named order.out. The order information that is output for each item consists of two lines: The first line contains the quantity of the item, a blank, the wholesale cost for that quantity of items, and an end-of-line character. The second line contains the description of the item and an end-of-line character. Design your program to ask for two different items to order. Write your design in the following space. Your design should be a list of Java comments without any code.
1. b. Write a Java program based on the design you created in Exercise 1a. Enter the program, saving it as Gifts1.java, and then execute the program. Follow your instructor’s require- ments for submitting output.Save your source code,your .class file, and your order.out file to the device or location specified by your instructor. (Windows users can copy the active window or dialog box by pressing Alt+Print Scrn to copy the active window or dialog box to the Clipboard. Each time a new dialog box appears during execution, you can save the output to a separate document using a program such as Microsoft Word. If this is done,name your document Gifts1Screens.doc, and then print the Gifts1Screens document and attach it to a printed copy of your program along with the printed copy of your order.out file.) (UNIX users should save their .class file to disk, then either submit the disk or send the file electronically to their instructor.) Following are copies of dialog boxes that might appear depending on the data entered. After the dialog boxes, a copy of the order.out file that you created is displayed.
2. a. Design a program that builds on Gifts1.java. Copy the order.out file that you created in Lab 3.4 Exercise 1 and save it as order.in to the device or location specified by your instructor.
After the gift shop has received an order from the wholesaler, the program should create an inventory file.Assume that all items ordered were received. Design your program to read the file order.in and write the file inventory.out.The file inventory.out will contain the num- ber of items received,the retail cost that is found by dividing the wholesale cost by the quan- tity ordered and multiplying by 2.4, and the description of the item.
Write your design in the following space. Your design should be a list of Java comments with- out any code.
2. b. Write a Java program based on the design you created in Exercise 2a. Enter the program,sav- ing it as Gifts2.java, and then execute the program. Follow your instructor’s requirements for submitting output. Save your source code, your .class file,and your inventory.out file to the device or location specified by your instructor.
(Windows users can copy the active window or dialog box by pressing Alt+Print Scrn to copy the active window or dialog box to the Clipboard. Each time a new dialog box appears during execution,you can save the output to a separate document using a program such as Microsoft Word.If this is done,name your document Gifts2Screens.doc, and then print the Gifts2Screens document and attach it to a printed copy of your program along with the printed copy of your inventory.out file.)
(UNIX users should save their .class file to disk, then either submit the disk or send the file electronically to their instructor.)
Following are copies of dialog boxes that might appear depending on the data in the file order.in.After the dialog boxes is a copy of the inventory.out file.
Step by Step Solution
3.38 Rating (145 Votes )
There are 3 Steps involved in it
Step: 1
1 a Design java Design 1 Prompt the user to enter information for two different items to order 2 For each item ask for Quantity Wholesale cost per ite...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