Repository navigation
Home
Albert edited this page Oct 5, 2026
·
1 revision
Welcome to the PersonCarDog wiki!
Here’s the flow for the use case
buyCarwith all operations being successful, so the user picks option #4 and both people can make the deal because the car exists.:
-
App.main→Controller.run() - Inside the loop:
Utils.mainMenu()+Utils.askMenuOption(scan) - User chooses 4 →
Service.buyCar(b, a, 100, repo) - Inside
buyCar: the transfer
buyer.setCar(car)+seller.setCar(null) - Creation of the
CarTransactionobject - Add the
CarTransactionobject to repo:repo.addCarTransaction(transaction) - return buyCar:
true - The
controllerkeeps thewhile(true){}working - Inside the loop:
Utils.mainMenu()+Utils.askMenuOption(scan) - User must select option another time
- Waiting ...
src/
└── main/
└── java/
└── org/
└── example/
├── App.java
├── controller/
│ └── Controller.java
├── model/
│ ├── Car.java
│ ├── CarTransaction.java
│ ├── Dog.java
│ └── Person.java
├── repository/
│ └── Repository.java
├── service/
│ └── Service.java
└── utils/
└── Utils.java
sequenceDiagram
participant App
participant Controller
participant Utils
participant Service
participant Repo as Repository
participant Model
App->>Controller: run()
loop while(true)
Controller->>Utils: mainMenu()
Controller->>Utils: askMenuOption(scan)
Utils-->>Controller: option = "4"
Controller->>Service: buyCar(b, a, 100, repo)
Service->>Model: buyer.setCar(car)
Service->>Model: seller.setCar(null)
Service->>Model: new CarTransaction(...)
Service->>Repo: addCarTransaction(transaction)
Service-->>Controller: true
end
Note over Controller: Waiting for next selection...