help with binary files: 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 given the file "accounts-wiht-names-dat" which is a binary file   required ouput: 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\   can an expert help me produce a java code to display the required infromation retireved from the given binary file i have this coding so far import java.io.*; import java.util.*; public class AccountBalance { public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); System.out.println("Enter a balance"); double input = keyboard.nextDouble(); System.out.printf("Accounts with a balance of at least $%.2f (sorted by balance)%n", input); System.out.printf("%20s%20s%10s%10s%n","Name", "Account Number", "Balance", "Cash Back");   this gives me the general format, however, i am having trouble producing the rest of the required output(the information in bold)

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
help with binary files:
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 given the file "accounts-wiht-names-dat" which is a binary file
 
required ouput:
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\
 
can an expert help me produce a java code to display the required infromation retireved from the given binary file
i have this coding so far
import java.io.*;
import java.util.*;

public class AccountBalance {
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);

System.out.println("Enter a balance");
double input = keyboard.nextDouble();
System.out.printf("Accounts with a balance of at least $%.2f (sorted by balance)%n", input);
System.out.printf("%20s%20s%10s%10s%n","Name", "Account Number", "Balance", "Cash Back");
 
this gives me the general format, however, i am having trouble producing the rest of the required output(the information in bold)
 
Expert Solution
Step 1: Java's DataInputStream class, which provides methods for reading primitive data types

To read a binary file, you will need to use Java's DataInputStream class, which provides methods for reading primitive data types from an input stream.

Here's some code to get you started:

CODE in JAVA:

try {
    FileInputStream file = new FileInputStream("accounts-wiht-names-dat");
    DataInputStream input = new DataInputStream(file);
    
    // Read data from the file here
    
    input.close();
} catch (IOException e) {
    e.printStackTrace();
}

 

 

Next Step:

Now, you can use the input object to read the data from the file. You'll need to use the appropriate read method for each data type, and you'll need to read the data in the same order that it's stored in the file. Here's an example of how to read an int:

int nameLength = input.readInt();

trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 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-engineering and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY