Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8901263
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T01:18:17+00:00 2026-06-15T01:18:17+00:00

I have created a method to print my files, however it only passes the

  • 0

I have created a method to print my files, however it only passes the true value instead of my actual values from the .dat file. Will you take a look at my method and tell what i’m doing wrong, please? Thank you so much.

calls the printing method:

System.out.println(printColumnHeaders(vehicles[x], false, false));

My Printing method:

private  static  boolean  printColumnHeaders(Vehicle vehicle,boolean isFirst,boolean printFull ) {

    if(isFirst && printFull) {
         System.out.println(vehicle.printFullHeadings());
         isFirst = true;
         printFull = true;
     }
     else  if(isFirst){
         System.out.println(vehicle.printSummaryHeadings());
         isFirst = true;
     }
    return false; 
    }

this method suppose to check If isFirst boolean value is true and printFull boolean value is true
then, Call the vehicle’s printFullHeadings method
next, Else if isFirst boolean value is true
last, Call the vehicle’s printSummaryHeadings method

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T01:18:20+00:00Added an answer on June 15, 2026 at 1:18 am

    here is how I fixed it:

    private static void displayVehicleData(String displayType) {
        boolean isFirst = true;
    
        for(int x = 0; x < vehicles.length; x++){
    
            switch(displayType) {
    
                case "Vehicles" : // List All Vehicles
                    isFirst = printColumnHeaders(vehicles[x], false, isFirst);
                        System.out.println(vehicles[x].printSummaryOutput());
    
                    break;
                case "Cars": // List All Cars
                        if(vehicles[x].getVehicleType().equals("American Car") || 
                            vehicles[x].getVehicleType().equals("Foreign Car")) {
                            isFirst = printColumnHeaders(vehicles[x], false, isFirst);
                            System.out.println(vehicles[x].printSummaryOutput());
                        }
    

    Printing method:

    private  static  boolean  printColumnHeaders(Vehicle vehicle, boolean printFull, boolean isFirst) {
    
                    if(isFirst && printFull){
                        System.out.println(vehicle.printFullHeadings());
                    }                                       
                    else if (isFirst){
                        System.out.println(vehicle.printSummaryHeadings());
                    }
    
                return false;
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a custom shipping method to show depo-names from which customers will
I have created a method to check if the keyboard is used in an
I have created a method that should ideally take a single Account object and
I have created a custom method that will return unique items, together with the
I have created a new method in one of the project's controllers that it
I have created a UserControl called AutorControl with a method to clear its textbox:
I have created several UI elements in the viewDidLoad method. I want to change
I have created a gem that adds a new method to the class ActiveRecord::Base.
I have created a class library called AddServiceLibrary in which I have a method
I have created a Webpage which will post as post method..not as get method.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.