Need to add a loop until a sentinel value in entered. entering “Stop” for the name for the program end. how can i add a loop to create bank accounts
Need to add a loop until a sentinel value in entered. entering “Stop” for the name for the program end. how can i add a loop to create bank accounts
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
100%
Need to add a loop until a sentinel value in entered. entering “Stop” for the name for the program end. how can i add a loop to create bank accounts

Transcribed Image Text:The image contains a section of a Java program that appears to be related to loan calculations. Below is a transcription and explanation of the code:
```java
System.out.println("No Account opened for "+fName+" "+lName+", requires minimum $100.00 loan amount for Variable.");
return;
}
else
{
Random random=new Random();
double x=random.nextInt( bound: 15-5+1)+5;
r=Math.max(x,(L/(i*12+10)))/100;
if(type.equalsIgnoreCase( anotherString: "fixed"))
{
if(L<=1000)
r=0.0825;
else if(L>1000&&L<=5000)
r=0.0935;
else if(L>5000&&L<=10000)
r=0.1045;
else
r=0.1625;
}
double mPay=L*(r/n)*Math.pow(1+(r/n), i*n)/(Math.pow(1+(r/n), i*n)-1);
System.out.println("/n"+fName+" "+lName);
Random random=new Random();
int acno=random.nextInt( bound: 10000)+1;
System.out.println("Acct No: "+acno);
if(type.equalsIgnoreCase( anotherString: "fixed"))
System.out.println("Fixed Loan for "+i+" years at Interest Rate of "+String.format("%.2f", r*100)+"%");
if(type.equalsIgnoreCase( anotherString: "variable"))
System.out.println("Variable Loan for "+i+" years at Interest Rate of "+String.format("%.2f", r*100)+"%");
System.out.println("Loan Amount: "+String.format("%.2f", L));
System.out.println("Monthly Payment: "+String.format("%.2f", mPay));
}
```
**Code Explanation:**
1. **Account Check and Random Interest Rate Calculation:**
- Checks if the loan amount is at least $100.00 for a "Variable" account.
- If not, it prints a message and exits.
- Otherwise, it creates a `Random` object to generate a random interest rate.
2. **Interest Rate and Loan Type:**
- It checks if the loan type is "fixed".
- Depending on the loan amount (`L`), it assigns a specific interest rate (`r
![```java
import java.io.*;
import java.util.*;
class bankLoanProcess
{
public static void main(String[] args) throws IOException
{
InputStreamReader ir = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(ir);
System.out.print("Enter your first name: ");
String fName = br.readLine().toUpperCase();
System.out.print("Enter your last name: ");
String lName = br.readLine().toUpperCase();
System.out.print("Enter type of account: ");
String type = br.readLine();
if (!type.equalsIgnoreCase("variable") && !type.equalsIgnoreCase("fixed"))
{
System.out.println("Invalid Account Type entered...");
}
System.out.print("Enter loan amount: ");
double L = Double.parseDouble(br.readLine());
double n = 12;
double r = 0.0;
System.out.print("Enter time of loan in years: ");
int i = Integer.parseInt(br.readLine());
if(type.equalsIgnoreCase("variable"))
if(L < 100)
{
System.out.println("No Account opened for " + fName + " " + lName + ", requires minimum $100.00 loan amount for Variable Account");
return;
}
// Additional processing can be added here
}
}
```
**Explanation:**
This Java code is a simple program designed to gather basic information about a user who is interested in opening a bank loan account. The program requires user input for the first and last names, type of account, loan amount, and the duration of the loan in years.
**Key Features:**
- **User Input:** The program takes input from the user for first name, last name, type of account, loan amount, and duration of the loan.
- **Account Type Validation:** It checks if the entered account type is either "variable" or "fixed". If not, it prints an error message.
- **Loan Amount Validation:** For a "variable" account type, the program ensures that the loan amount is at least $100. If the amount is less than $100, it prints a message stating that an account cannot be opened.
- **Uppercase Conversion:** The provided first name and last name inputs are converted to uppercase.
- **Exception Handling:** The program uses `throws IOException` to handle possible input/output exceptions.
This basic structure](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F409fe3ef-4de5-45d0-8099-83a4623a506c%2F61fb0886-2b2a-4365-88df-8e871a85e350%2Fn8maqna_processed.jpeg&w=3840&q=75)
Transcribed Image Text:```java
import java.io.*;
import java.util.*;
class bankLoanProcess
{
public static void main(String[] args) throws IOException
{
InputStreamReader ir = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(ir);
System.out.print("Enter your first name: ");
String fName = br.readLine().toUpperCase();
System.out.print("Enter your last name: ");
String lName = br.readLine().toUpperCase();
System.out.print("Enter type of account: ");
String type = br.readLine();
if (!type.equalsIgnoreCase("variable") && !type.equalsIgnoreCase("fixed"))
{
System.out.println("Invalid Account Type entered...");
}
System.out.print("Enter loan amount: ");
double L = Double.parseDouble(br.readLine());
double n = 12;
double r = 0.0;
System.out.print("Enter time of loan in years: ");
int i = Integer.parseInt(br.readLine());
if(type.equalsIgnoreCase("variable"))
if(L < 100)
{
System.out.println("No Account opened for " + fName + " " + lName + ", requires minimum $100.00 loan amount for Variable Account");
return;
}
// Additional processing can be added here
}
}
```
**Explanation:**
This Java code is a simple program designed to gather basic information about a user who is interested in opening a bank loan account. The program requires user input for the first and last names, type of account, loan amount, and the duration of the loan in years.
**Key Features:**
- **User Input:** The program takes input from the user for first name, last name, type of account, loan amount, and duration of the loan.
- **Account Type Validation:** It checks if the entered account type is either "variable" or "fixed". If not, it prints an error message.
- **Loan Amount Validation:** For a "variable" account type, the program ensures that the loan amount is at least $100. If the amount is less than $100, it prints a message stating that an account cannot be opened.
- **Uppercase Conversion:** The provided first name and last name inputs are converted to uppercase.
- **Exception Handling:** The program uses `throws IOException` to handle possible input/output exceptions.
This basic structure
Expert Solution

Step 1
Before statement enter your first name , insert a while true loop.
Once input is taken in fName, check if fName.equals("END")
Then break loop
.
Step by step
Solved in 3 steps with 1 images

Knowledge Booster
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.Recommended textbooks for you

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education