Ask the user for an account balance. Show, in descending order, all the accounts that have a balance greater than what the user input. Each entry is int, string, long, double, boolean (name length, name, credit card number, balance, cashback). I am having trouble displaying the required information produces from a binary file Enter a balance\n 9000ENTER Accounts with a balance of at least $9000.00 (sorted by balance)\n Name Account Number Balance Cash Back\n Brand Hallam 3573877643495486 9985.21 No\n Paco Verty 4508271490627227 9890.51 No\n Stanislaw Dhenin 4405942746261912 9869.27 No\n Eachelle Balderstone 30526110612015 9866.30 No\n Reube Worsnop 3551244602153760 9409.97 Yes\n Tiphanie Oland 5100172198301454 9315.15 No\n Jordan Rylstone 201715141501700 9135.90 Yes\n 7 results\n ------ Enter a balance\n 8000ENTER Accounts with a balance of at least $8000.00 (sorted by balance)\n Name Account Number Balance Cash Back\n Brand Hallam 3573877643495486 9985.21 No\n Paco Verty 4508271490627227 9890.51 No\n Stanislaw Dhenin 4405942746261912 9869.27 No\n Eachelle Balderstone 30526110612015 9866.30 No\n Reube Worsnop 3551244602153760 9409.97 Yes\n Tiphanie Oland 5100172198301454 9315.15 No\n Jordan Rylstone 201715141501700 9135.90 Yes\n Anjela Himsworth 3573904891259172 8985.27 Yes\n Howie Royson 3581572129932389 8965.07 Yes\n Blinni Mattke 3549214734886202 8960.76 No\n Dorotea Nolli 6396392530990977 8790.59 Yes\n Carita Savill 6767642427889745 8738.77 No\n Mateo Mollene 5100174906912671 8659.35 Yes\n Cathleen Schurcke 4041598930132416 8596.39 Yes\n Adriana Bru 3574931681854879 8482.46 Yes\n Orlando Nutbeem 6372756913380048 8346.07 No\n Leland Vasilyev 6394213548410265 8249.76 No\n Ambrosi Fussie 3581429661693202 8207.40 Yes\n Valentine Montford 3533184590527943 8176.80 Yes\n Sarette Springell 5100146117467372 8161.69 Yes\n Rich Yakovl 490337929898976334 8099.58 Yes\n Conney Sizeland 3588215263928408 8036.12 Yes\n 22 results\n can an expert help me produce the required information I need, specifically focusing on producing the names, account number, balance, cashback, and results that I need to display in descending order such as Brand Hallam 3573877643495486 9985.21 No\n Paco Verty 4508271490627227 9890.51 No\n Stanislaw Dhenin 4405942746261912 9869.27 No\n Eachelle Balderstone 30526110612015 9866.30 No\n Reube Worsnop 3551244602153760 9409.97 Yes\n Tiphanie Oland 5100172198301454 9315.15 No\n Jordan Rylstone 201715141501700 9135.90 Yes\n 7 results\ i have this code so far import java.io.*; import java.util.*; public class AccountBalance { public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); List list = new ArrayList<>(); try { FileInputStream file = new FileInputStream("accounts-with-names.dat"); DataInputStream input = new DataInputStream(file); // Read data from the file and store it in an array or list here // Sort the data based on the balance here System.out.println("Enter a balance"); double inputBalance = keyboard.nextDouble(); System.out.printf("Accounts with a balance of at least $%.2f (sorted by balance)%n", inputBalance); System.out.printf("%20s%20s%10s%10s%n", "Name", "Account Number", "Balance", "Cash Back"); while (input.available() > 0) { String name = input.readUTF(); long accountNumber = input.readLong(); double balance = input.readDouble(); boolean cashBack = input.readBoolean(); File acc = new Account(name, accountNumber, balance, cashBack); list.add(acc); } } catch (IOException e) { e.printStackTrace(); } Collections.sort(list); // sort by balance int count = 0; for (Account acc : list) { if (acc.getbalance() >= input) { System.out.printf("%20s%20d%20.2f%12s%n", acc.getname(), acc.getAccountNumber(), acc.getBalance(), acc.hasCashBack() ? "Yes" : "No"); count++; } } System.out.printf("%d result%s%n", count, count == 1 ? "" : "s"); } }

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
icon
Related questions
Question

Ask the user for an account balance. Show, in descending order, all the accounts that have a balance greater than what the user input. Each entry is int, string, long, double, boolean (name length, name, credit card number, balance, cashback).

I am having trouble displaying the required information produces from a binary file

Enter a balance\n
9000ENTER
Accounts with a balance of at least $9000.00 (sorted by balance)\n
Name Account Number Balance Cash Back\n
Brand Hallam 3573877643495486 9985.21 No\n
Paco Verty 4508271490627227 9890.51 No\n
Stanislaw Dhenin 4405942746261912 9869.27 No\n
Eachelle Balderstone 30526110612015 9866.30 No\n
Reube Worsnop 3551244602153760 9409.97 Yes\n
Tiphanie Oland 5100172198301454 9315.15 No\n
Jordan Rylstone 201715141501700 9135.90 Yes\n
7 results\n

------

Enter a balance\n
8000ENTER
Accounts with a balance of at least $8000.00 (sorted by balance)\n
Name Account Number Balance Cash Back\n
Brand Hallam 3573877643495486 9985.21 No\n
Paco Verty 4508271490627227 9890.51 No\n
Stanislaw Dhenin 4405942746261912 9869.27 No\n
Eachelle Balderstone 30526110612015 9866.30 No\n
Reube Worsnop 3551244602153760 9409.97 Yes\n
Tiphanie Oland 5100172198301454 9315.15 No\n
Jordan Rylstone 201715141501700 9135.90 Yes\n
Anjela Himsworth 3573904891259172 8985.27 Yes\n
Howie Royson 3581572129932389 8965.07 Yes\n
Blinni Mattke 3549214734886202 8960.76 No\n
Dorotea Nolli 6396392530990977 8790.59 Yes\n
Carita Savill 6767642427889745 8738.77 No\n
Mateo Mollene 5100174906912671 8659.35 Yes\n
Cathleen Schurcke 4041598930132416 8596.39 Yes\n
Adriana Bru 3574931681854879 8482.46 Yes\n
Orlando Nutbeem 6372756913380048 8346.07 No\n
Leland Vasilyev 6394213548410265 8249.76 No\n
Ambrosi Fussie 3581429661693202 8207.40 Yes\n
Valentine Montford 3533184590527943 8176.80 Yes\n
Sarette Springell 5100146117467372 8161.69 Yes\n
Rich Yakovl 490337929898976334 8099.58 Yes\n
Conney Sizeland 3588215263928408 8036.12 Yes\n
22 results\n

can an expert help me produce the required information I need, specifically focusing on producing the names, account number, balance, cashback, and results that I need to display in descending order such as

Brand Hallam 3573877643495486 9985.21 No\n
Paco Verty 4508271490627227 9890.51 No\n
Stanislaw Dhenin 4405942746261912 9869.27 No\n
Eachelle Balderstone 30526110612015 9866.30 No\n
Reube Worsnop 3551244602153760 9409.97 Yes\n
Tiphanie Oland 5100172198301454 9315.15 No\n
Jordan Rylstone 201715141501700 9135.90 Yes\n
7 results\

i have this code so far

import java.io.*;
import java.util.*;
public class AccountBalance {
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
List<Account> list = new ArrayList<>();
try {
FileInputStream file = new FileInputStream("accounts-with-names.dat");
DataInputStream input = new DataInputStream(file);
// Read data from the file and store it in an array or list here

// Sort the data based on the balance here

System.out.println("Enter a balance");
double inputBalance = keyboard.nextDouble();
System.out.printf("Accounts with a balance of at least $%.2f (sorted by balance)%n", inputBalance);
System.out.printf("%20s%20s%10s%10s%n", "Name", "Account Number", "Balance", "Cash Back");

while (input.available() > 0) {
String name = input.readUTF();
long accountNumber = input.readLong();
double balance = input.readDouble();
boolean cashBack = input.readBoolean();
File acc = new Account(name, accountNumber, balance, cashBack);
list.add(acc);
}
} catch (IOException e) {
e.printStackTrace();
}
Collections.sort(list); // sort by balance
int count = 0;
for (Account acc : list) {
if (acc.getbalance() >= input) {
System.out.printf("%20s%20d%20.2f%12s%n",
acc.getname(), acc.getAccountNumber(), acc.getBalance(),
acc.hasCashBack() ? "Yes" : "No");
count++;
}
}

System.out.printf("%d result%s%n", count, count == 1 ? "" : "s");
}
}

this isnt the right codign to produce the information i need, i am gettin stuck, can a java expert help fix my code 

Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
File Input and Output Operations
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
Database System Concepts
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)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education