Question
Homework A1: Guss Scout Troop System Demonstrated proficiency: Constructors, Overloaded Methods, Object Reference Variables, Static Fields and Methods, Access Specifiers (Private & Public), Encapsulation, use
Homework A1: Guss Scout Troop System Demonstrated proficiency: Constructors, Overloaded Methods, Object Reference Variables, Static Fields and Methods, Access Specifiers (Private & Public), Encapsulation, use of this, ArrayList.
Gus needs software to help manage his Scout troop. His troop size can be anywhere from 2 to infinity. For each scout, he needs to store their first name, last name, rank and the merit badges they earned. Gus also needs to be able to print
The troop count (how many scouts are members of his troop)
A list of all the troop members (listing only their last names)
The scout with the most merit badges
The scout with the least merit badges Gus also likes his print outs nicely formatted.
Create two classes, a Scout class and a ScoutDriver class.
1. The Scout class will be used to instantiate a scout object. It must include the following
a. Two constructors as Gus likes the option of creating scout different ways
i. public Scout() One takes no arguments. It updates the count of troop members
ii. public Scout(String fName, String lName, String rank) One takes the first name, last name and rank as arguments. It updates the count of troop members.
b. An ArrayList for the merit badges.
i. public ArrayList getMeritBadges() a getter method to return the arraylist of badges
ii. public void setMeritBadges(String singleMeritBadge) a method to add a single badge to the arraylist.
iii. public void setMeritBadges(ArrayList multipleMeritBadges) a method to add multiple badges to the arrylist.
c. A static variable to keep track of the troop count
d. public static String getTroopCount() Returns a string with the number of troops.
e. All fields are private. f. Getters and setters for fields not specified above.
2. The ScoutDriver class will contain a main method.
a. The individual scout members will be created and stored in an arraylist here.
b. After all the troop members are added, the troop count will be printed using the static method.
c. The list of troop members will be printed
d. The scout with the most badges will be printed
e. The scout with the least badges will be printed.
Complete the code before the due date. Submission of the completed eclipse project is via github link posted on the class page.
__________Example from ScountDriver shown below
The number of scouts in the troop is 2 Troop members - Last name only
______________________________
Bunny Duck
Troop member with most number merit badges
__________________________________________
Bugs Bunny with 3 badges Troop member with least number merit badges
___________________________________________
Daffy Duck with 2 badges
public class ScoutDriver { public static void main(String[] args) { //Rank is either Scout, Tenderfoot, Second Class, First Class or Eagle //Merit badges are a combination of Archery, Backpacking, Chess, Drafting, Engineering, Fishing //1) create scout. fName:Bugs lName:Bunny, Rank:Scout, //2) Add multiple badges to already created scout. badges: Backpacking, Chess, Drafting //3)create another scout object, without any initial info. //4)Add fName:Daffy //5)Add lName:Duck //6)Add Rank:Tenderfoot, //7)Add Single badge: Archery //8)Add Single badge: Fishing //9)Use static method of the Scout class to display the number of scouts in the troop //10)Display a list of the troop using only last names //11)Display scout with the most number badges //12)display scout with the least number of badges }}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started