Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Given the java the skeleton code below: import javax.swing.JOptionPane; public class Lab 3 _ 2 { public static void main ( String [ ] args

Given the java the skeleton code below:
import javax.swing.JOptionPane;
public class Lab3_2{
public static void main(String[] args){
String fName = JOptionPane.showInputDialog(gui,
"Enter the name of the file");
/* Add remaining code here */
}
}
a. Write Java statements that import the classes Scanner, FileReader, and PrintWriter from the packages java.util and java.io.
b. Write statements that declare fScnr to be a reference variable of type Scanner and fout to be a reference variable of type PrintWriter.
c. The program will read data from the file inData.txt and write output to the file outData.dat. Write statements to open both these files, associate fin with inData.txt, and associate fout with outData.dat.
d. Suppose that the file inData.txt contains the following data:
10.205.35
15.6
Randy Gill 31
185003.5
D
The numbers in the first line represent the length and width, respectively, of a rectangle. The number in the second line represents the radius of a circle. The third line contains the first name, last name, and the age of a person. The first number in the fourth line is the savings account balance at the beginning of the month and the second number is the interest rate per year. (Assume that pi =3.141592653589793) The fifth line contains an uppercase letter between A and Y (inclusive). Write statements so that after the program executes, the contents of the file outData.txt are as shown below. If necessary, declare additional variables. Your statements should be general enough so that if the content of the input file changes and the program is run again (without editing and recompiling), it outputs the appropriate results.
Rectangle:
Length =10.20, width =5.35, area =54.57, parameter =31.10
Circle:
Radius =15.60, area =764.54, circumference =98.02
Name: Randy Gill, age: 31
Beginning balance = $18500.00, interest rate =3.50
Balance at the end of the month =$18553.96
The character that comes after D in the ASCII set is E
e. Write the statement that closes the output file.
f. Write a Java application program that tests the Java statements that you wrote in parts ae. Add screenshot of output here

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_2

Step: 3

blur-text-image_3

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

Database Systems Design Implementation And Management

Authors: Peter Rob, Carlos Coronel

6th International Edition

061921323X, 978-0619213237

More Books

Students also viewed these Databases questions

Question

The amount of work I am asked to do is reasonable.

Answered: 1 week ago

Question

The company encourages a balance between work and personal life.

Answered: 1 week ago