I have two different parts to my program. My FundRaising.java is my problem. I'm having problems with my print statements. Why are the correct numbers not showing up? I keep getting 0.
System.out.println (booster1);
System.out.println (booster2);
I ask the question to get the numbers and I keep on getting 0
System.out.println ("What is the sales for the first week:");
numBoxes = scan.nextInt();
booster1 = numBoxes.BandBooster(name);
//*********************************************************************
// FundRaising.java
//
// Tracks band candy sales of two band boosters over two weeks.
//*********************************************************************
import java.util.Scanner;
public class FundRaising
{
//-------------------------------------------------------
// Creates 2 band boosters and gets their sales of band
// candy over a period of two weeks. Total sales
// are computed for each band booster.
//-------------------------------------------------------
public static void main (String[] args)
{
String name;
BandBooster booster1;
BandBooster booster2;
int numBoxes;
int boxesSold=0;
Scanner scan = new Scanner(System.in);
System.out.println ("Band Sales Program\n");
//Get names of band boosters
System.out.print ("Enter the name of the first booster: ");
name = scan.nextLine();
booster1 = new BandBooster (name);
System.out.print ("Enter the name of the second booster: ");
name = scan.nextLine();
booster2 = new BandBooster (name);
//Get sales for week 1
// add your code here
System.out.println ("What is the sales for the first week:");
numBoxes = scan.nextInt();
booster1 = numBoxes.BandBooster(name);
//Get sales for week 2
// add your code here
System.out.println ("What is the sales for the second week:");
numBoxes = scan.nextInt();
//summation
//boxesSold += numboxes1 + numboxes2;
// print summary for both band boosters.
//System.out.println(booster1 + " sold " + numboxes1 + " band boosters");
//System.out.println(booster2 + " sold " + numboxes2 + " band boosters");
System.out.println();
System.out.println ("Sales Totals");
System.out.println (booster1);
System.out.println (booster2);
//System.out.println("*************************");
//System.out.println (booster1);
}
}
//*********************************************************************
// BandBooster.java
//
// Represents a band booster who sells candy for the band fundraiser.
//*********************************************************************
public class BandBooster
{
// Instance variables
private String name;
private int boxesSold;
//----------------------------------------------------------------
// Constructor - sets up a band booster by initializing the name.
//----------------------------------------------------------------
public BandBooster(String ename)
{
name= ename;
boxesSold=0;
}
//add your code here.
//----------------------------------------------------------------
// getName method returns the name of the booster.
//----------------------------------------------------------------
public String getName()
{
return name;
}
//add your code here.
//----------------------------------------------------------------
// Updates the number of boxes of candy sold by adding the
// number specified in the parameter to the number sold so far.
//----------------------------------------------------------------
public void updateSales(int numBoxes)
{
boxesSold += numBoxes;
}
//add your code here.
//----------------------------------------------------------------
// Returns a string representation of a band booster.
//----------------------------------------------------------------
public String toString ()
{
return (name + ":" + "\t" + boxesSold + " boxes");
}
// add your code here.
}