Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Main method. This method is called automatically
- * when the program is executed.
- * @param args main arguments
- */
- public static void main(String[] args) {
- Club club = new Club();
- club.test_main(club);
- }
- /**
- * Actual main method, invoked by {@code main} method.
- * This method is used because the {@code main} method needs
- * to be static.
- * @param club the entire club. [Club]
- * @see main
- */
- public void test_main(Club club) {
- //1) Adding an admin, some users and some activities
- Admin owner = new Admin("Jeff","Bezos","[email protected]","unaPasswordMoltoStrong");
- owner.addUser(club, "Francesco", "Petrarca", "[email protected]","canzoniereRules");
- owner.addUser(club, "Jean Baptiste Joseph", "Fourier", "[email protected]","iLoveDirac");
- owner.addUser(club, "Dmitrij Ivanovic", "Mendeleev", "[email protected]", "atomicNumbersRules");
- owner.addUser(club, "tmp", "tmp", "[email protected]", "passwd");
- owner.addLesson(club, "Pallavolo");
- owner.addLesson(club, "Pilates");
- owner.addRace(club, "Tiro con l'arco");
- owner.addRace(club, "Karate");
- //2) modifing&removing users
- owner.setEmail(club.users.get(3), "[email protected]");
- owner.setName(club.users.get(3), "new_name");
- owner.setSurname(club.users.get(3), "new_surname");
- owner.removePeople(club, club.users.get(3));
- //3) choosing a random user
- Random rand = new Random();
- User rand_user = club.users.get(rand.nextInt(club.users.size()));
- //4.1) the user subscribes to a race and a lesson
- Lesson rand_less = club.lessons.get(rand.nextInt(club.lessons.size()));
- Race rand_race = club.races.get(rand.nextInt(club.races.size()));
- rand_user.subscribeLesson(rand_less);
- rand_user.subscribeRace(rand_race);
- //4.2) unsubscribing from random activity
- if(rand.nextInt(2) == 1){
- rand_user.unsubscribeLesson(rand_less);
- } else {
- rand_user.unsubscribeRace(rand_race);
- }
- //5)presenting data
- printLessons(club);
- printRaces(club);
- printUsers(club);
- }
Advertisement
Add Comment
Please, Sign In to add comment