Ask the user for an account balance. Show, in descending order, all the accounts that have a…

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 do not have the file stated since I can not copy it. Please correct my work to the best of your ability.

Here is the code I have:

import java.util.Scanner;
public class AccountBalance {
 public static void main(String[] args) throws IOException {
 FileInputStream basic = new FileInputStream( "accounts-with-names.dat");
 DataInputStream inputFile = new DataInputStream(basic);
 boolean eof = false;
 System.out.println("Enter a balance");
 Scanner keyboard = new Scanner(;
 double input = keyboard.nextDouble();
 System.out.println("Accounts with a balance of at least $" + String.format("%.2f", input) + " (sorted by balance)");
 System.out.println(" Name Account Number Balance Cash Back");
 String name = "";
 int counter = 0;
 while (!eof)
 for (int nameLength = inputFile.readInt(); nameLength < 500; ++nameLength)
 Character name1 = inputFile.readChar();
 name = name + name1;
 long cardnumber = inputFile.readLong();
 double balance = inputFile.readDouble();
 boolean cashback = inputFile.readBoolean();
 if (balance > input)
 System.out.print(String.format("%20" + "s", name));
 System.out.print(String.format("%20" + "s", cardnumber));
 System.out.print(String.format("%10" + "s", String.format("%.2f",balance)));
 if (cashback)
 System.out.println(String.format("%" + 12 + "s", "Yes"));
 System.out.println(String.format("%" + 12 + "s", "No"));

 catch (EOFException e)
 eof = true;
 System.out.println(String.format("%" + 42 + "s", counter + " results"));

Here is the output it’s meant to have:

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

Place your order
(550 words)

Approximate price: $22

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
The price is based on these factors:
Academic level
Number of pages
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more
error: Content is protected !!