You are on page 1of 7

Week 13 Activity

Group Project Task List

Student Name Student Id Role


Ricky Roberto Lagan 001202300157 Team Leader
Alysa Milano 001202300089 Member 1
Amanda Putri 001202300078 Member 2

Chapter 1. Introduction

Chapter 1: Introduction

1.1 Background

In this digital era, the development of computer programs has become commonplace for solving
everyday problems. In this context, we as a project team decided to create a simple program that
could help in the purchase of bus tickets.

1.2 Identification of Problems

In everyday life, buying bus tickets often involves a manual process that can be time-consuming and
complicating for customers. Therefore, we decided to develop this program as a solution to simplify
and speed up the bus ticket purchase process.

1.3 Objective of the project

This project aims to create an efficient and easy-to-use bus ticket purchasing system. We want to
provide a better customer experience by providing an intuitive interface and automating the ticket
purchase process.

1.4 Project Scope

This program will allow users to select destinations, enter passenger data, and make payments with
an initial balance that can be entered by the user. In addition, the program will also record the
purchase history for customer references.

1.5 Benefits of the project

- Increased efficiency in the bus ticket purchase process.

- Providing a better user experience.

- Creating transaction records that are accessible to users.


1.6 The report structure

This report will be structured in several chapters, covering program descriptions, flowcharts, source
codes, screenshots, requirements checks, and working hours logs. It aims to provide an in-depth
understanding of the development of this program.

1.7 potential features

- Enable user to choose transaction actions

- Enable user to choose destination

- Enable user to re-entry if wrong input is given

- Enable to choose the exit option

- Enable to input name

With the background, problem identification, and project objectives outlined, the project is expected
to make a positive contribution in improving the bus ticket purchasing experience.

Chapter 2. Flowchart
Chapter 3: The Program

Provide the program in this section (copy and paste your program here)

Line Codes
1 package AgentTravel;
2
3 import java.util.Scanner;
4 public class TicketBus {
5 public static void main(String[] args) {
6 Scanner scanner = new Scanner(System.in);
7 String[] menu = {"Cikarang-Bandung", "Cikarang-Jakarta", "Cikarang-Bogor"};
8 double[] prices = {150000, 50000, 80000} ;
9 int[][] destinationDetails = {
10 {30, 10},
11 {40, 20},
12 {25, 5}
13 };
14 boolean[] selectedDestinations = new boolean[menu.length];
15 StringBuilder paymentHistory = new StringBuilder();
16
17 System.out.println("Welcome to the Destinations Selection Program!");
18 int option = 0;
19
20 while (option != 3) {
21 System.out.println("\nMenu:");
22 System.out.println("1. Buy Ticket");
23 System.out.println("2. Payment History");
24 System.out.println("3. Exit");
25 System.out.print("Enter your choice: ");
26
27 while (!scanner.hasNextInt()) {
28 System.out.println("Invalid input. Please enter a number.");
29 System.out.print("Enter your choice: ");
30 scanner.next();
31 }
32
33 option = scanner.nextInt();
34
35 switch (option) {
36 case 1:
37 char choice = 'y';
38
39 while (choice == 'y' || choice == 'Y') {
40 System.out.println("\nBus Menu:");
41 int i = 0;
42
43 while (i < menu.length) {
44 System.out.println((i + 1) + ". " + menu[i] + " - Rp" + prices[i] +
45 " (Available Seats: " + destinationDetails[i][1] + ")");
46 i++;
47 }
48
49 System.out.print("Enter your name: ");
50 scanner.nextLine();
51 String customerName = scanner.nextLine();
52 int destinationsNumber;
53
54 while (true) {
55 System.out.print("Enter the number of the destinations you want to buy: ");
56
57 while (!scanner.hasNextInt()) {
58 System.out.println("Invalid input. Please enter a valid food number.");
59 scanner.next();
60 }
61
62 destinationsNumber = scanner.nextInt();
63
64 if (destinationsNumber >= 1 && destinationsNumber <= menu.length &&
65 destinationDetails[destinationsNumber - 1][1] > 0) {
66 break;
67 } else {
68 System.out.println("Invalid input or no available seats. " +
69 "Please enter a valid destinations number with available seats.");
70 }
71 }
72
73 int quantity;
74
75 while (true) {
76 System.out.print("Enter the quantity you want to buy: ");
77
78 while (!scanner.hasNextInt()) {
79 System.out.println("Invalid input. Please enter a valid quantity.");
80 scanner.next();
81 }
82
83 quantity = scanner.nextInt();
84
85 if (quantity > 0 && quantity <= destinationDetails[destinationsNumber - 1][1])
86 {
87 break;
88 } else {
89 System.out.println("Invalid input or not enough available seats. " +
90 "Please enter a valid quantity within available seats.");
91 }
92 }
93
94 selectedDestinations[destinationsNumber - 1] = true;
95 destinationDetails[destinationsNumber - 1][1] -= quantity;
96 paymentHistory.append("Customer: ").append(customerName).append("\n");
97 paymentHistory.append("Destinations: ").append(menu[destinationsNumber -
98 1]).append(" - Rp").append(prices[destinationsNumber - 1]).append("\n");
99 paymentHistory.append("Quantity: ").append(quantity).append("\n");
100 double totalPrice = prices[destinationsNumber - 1] * quantity;
101 paymentHistory.append("Total Price: $").append(totalPrice).append("\n\n");
102 System.out.println(menu[destinationsNumber - 1] + " (Quantity: " + quantity + ")
103 added to your selection!");
104 System.out.print("Do you want to buy more Destinations? (y/n): ");
105 choice = scanner.next().charAt(0);
106 }
107 break;
108
109 case 2:
110 System.out.println("Payment History:\n" + paymentHistory.toString());
111 break;
112
113 case 3:
114 System.out.println("\nThank you for using the AgentTravel Class !");
115 break;
116
117 default:
118 System.out.println("Invalid choice. Please enter a valid option.");
119 }
120 }
121 scanner.close();;
123 }
124 }

Chapter 4: The Screenshot

- Enable user to choose transaction actions

- Enable user to choose destination


- Enable user to re-entry if wrong input is given

-Enable to choose the exit option

- Enable to input name

Chapter 5: Requirement checks

No Requirements Yes/No, Line No X – Y


1 Have at least one if / if-else and one Yes, 85-91
nested if-else
2 Have at least one while and one Yes, 20-92
nested while
3 Have at least one 1 Dimensional Yes, 6-8
Array
4 Have at least one 2 Dimensional Yes, 9-13
Array
5 Have at least one mathematical Yes, 35-47
operator calculation
6 Have at least one Boolean Yes, 14-120
expression
Chapter 6: Log Hours

Student Name Activity Log Hours


-Ricky Roberto Lagan - Codes 4 hours
- Reporting 4 hours
- Alysa Milano - Codes 4 hours
- Reporting 4 hours
- Amanda Putri - Codes 4 hours
- Flowchart 2 hours
- Reporting 2 hours

You might also like