Introduction to Java Programming and Data Structures: Brief Version (11th Global Edition)
Introduction to Java Programming and Data Structures: Brief Version (11th Global Edition)
11th Edition
ISBN: 9780134671710
Author: Y. Daniel Liang
Publisher: PEARSON
bartleby

Concept explainers

Question
Book Icon
Chapter 17, Problem 17.7PE
Program Plan Intro

Restore objects from a file

Program Plan:

Loan.java

  • Definition for the class “Loan”.
  • Declare the required variables.
  • Create default constructor
    • Pass the object through the constructor.
  • Create the parameterized constructor.
    • Assign annual interest rate, number of years, loan amount and date.
  • Definition for the method “getAnnualInterestRate()”.
    • Return “annualInterestRate”.
  • Definition for the method “getAnnualInterestRate()”.
    • Return the “getAnnualInterestRate”.
  • Definition for method “setAnnualInterestRate()”
    • Return the annual Interest Rate.
  • Definition for method “getNumberOfYears()”
    • Return the number of years.
  • Definition for method “setNumberOfYears()”.
    • Return  the loan amount.
  • Definition for method “setLoanAmount()”.
    • Assign  the number of years”.
  • Definition for method “getTotalPayment()”
    • Calculate the monthly interest rate.
    • Calculate the monthly payment.
    • Return monthly payment.
  • Definition for method “getTotalPayment”.
    • Calculate the total payment.
    • Return total payment.
  • Definition for “LoanDate()”.
    • Return the loan date.

Amount.java

  • Import required packages.
  • Definition for the class “Amount”.
  • Definition for main class.
    • Create five objects for loan to store it in the file.
    • Write the entire loan object to the file named “Exercise17_0.6.dat”.
  • Create an object to read the file from the file.
    • Display the loan amount.
    • Display the count and the total amount.

Blurred answer
Students have asked these similar questions
(what the output is suppose to look like in pictures with all the animals   ) (you don't have to write every animal like example I need help structuring the codes maybe 2 or four of each animal type but not all of them) in java A MyPetStore sells many pets and their accessories. As new pets are added to the MyPetStore, theirinformation is entered into a flat text file. Each month, the manager requests a listing of all pets sorted bytheir price. You must write a program to produce a report of MyPetStore and their types sorted by their pricesfrom the data in the flat text file. Below is a description of the information on the text file:• The first entry is the number of animals on the file (numeric) •The fields below repeat for each animal:o Pet name (String)o Birthdate (java.time.LocalDate)o Price (numeric)o Species Type (String)o Special feature (boolean or String)The animals sold by the MyPetStore are of six types: Dogs & Cats, Reptiles, Birds, Rabbits & SmallAnimals.For Dogs…
Objective:Design and implement a word unscrambler game in Java.Details:Your program should read in a random word from a file called words.txt (note the lack of capitalization) that you provide. There should not be any hard limit on the number of words in the file. If words were added/removed from the file, your program should recognize such changes of the words.txt and handle appropriately next time it runs. The file should contain one word per line. To read a random word you can generate a random number between 1 and the number of lines, and skip n-1 lines before reading the word. Scramble the word by swapping random pairs of letters a random number of times. Display the scrambled word with character indexes on top. Assume that the word is always no more than ten characters (so that index can be within 0-9 range, inclusive).Offer the user a menu with the following choices:• Enter 1 to swap a pair of lettersIf this option is selected prompt the user to enter two indexes and swap the…
Select the statement that is false regarding file guarding. Group of answer choices: In your .h files all code should be contained within the guards. It restricts the scope of a namespace, which prevents namespace pollution. If used properly it prevents redefinitions of classes/functions. It is an instruction to the preprocessor. It must make use of a unique identifier.

Chapter 17 Solutions

Introduction to Java Programming and Data Structures: Brief Version (11th Global Edition)

Ch. 17.4 - Does FileInputStream/Fi1eOutputStream introduce...Ch. 17.4 - What will happen if you attempt to create an input...Ch. 17.4 - How do you append data to an existing text file...Ch. 17.4 - Prob. 17.4.7CPCh. 17.4 - What is written to a file using writeByte(91) on a...Ch. 17.4 - How do you check the end of a file in an input...Ch. 17.4 - What is wrong in the following code? Import...Ch. 17.4 - Suppose you run the following program on Windows...Ch. 17.4 - After the following program is finished, how many...Ch. 17.4 - For each of the following statements on a...Ch. 17.4 - What are the advantages of using buffered streams?...Ch. 17.5 - How does the program check if a file already...Ch. 17.5 - How does the program detect the end of the file...Ch. 17.5 - How does the program count the number of bytes...Ch. 17.6 - Prob. 17.6.1CPCh. 17.6 - Prob. 17.6.2CPCh. 17.6 - Is it true that any instance of...Ch. 17.6 - Prob. 17.6.4CPCh. 17.6 - Prob. 17.6.5CPCh. 17.6 - What will happen when you attempt to run the...Ch. 17.7 - Can RandomAccessFi1e streams read and write a data...Ch. 17.7 - Create a RandomAccessFi1e stream for the file...Ch. 17.7 - What happens if the file test.dat does not exist...Ch. 17 - (Create a text file) Write a program to create a...Ch. 17 - (Create a binary data file) Write a program to...Ch. 17 - (Sum all the integers in a binary data file)...Ch. 17 - (Convert a text file into UTF) Write a program...Ch. 17 - Prob. 17.5PECh. 17 - Prob. 17.6PECh. 17 - Prob. 17.7PECh. 17 - (Update count) Suppose that you wish to track how...Ch. 17 - (Address book) Write a program that stores,...Ch. 17 - (Split files) Suppose you want to back up a huge...Ch. 17 - (Split files GUI) Rewrite Exercise 17.10 with a...Ch. 17 - Prob. 17.12PECh. 17 - (Combine files GUI) Rewrite Exercise 17.12 with a...Ch. 17 - (Encrypt files) Encode the file by adding 5 to...Ch. 17 - (Decrypt files) Suppose a file is encrypted using...Ch. 17 - (Frequency of characters) Write a program that...Ch. 17 - (BitOutputStream) Implement a class named...Ch. 17 - (View bits) Write the following method that...Ch. 17 - (View hex) Write a program that prompts the user...Ch. 17 - (Hex editor) Write a GUI application that lets the...
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education