Skip to content

Week 2 day 3#7

Open
Ngozistephen wants to merge 10 commits intoBloceducare:mainfrom
Ngozistephen:week-2-day-3
Open

Week 2 day 3#7
Ngozistephen wants to merge 10 commits intoBloceducare:mainfrom
Ngozistephen:week-2-day-3

Conversation

@Ngozistephen
Copy link

Task Submission PR

Student Info:

  • Registered Name: Ngozi Stephen
  • Week: week 2
  • Day: Day 3

Task Details:

  • Task Name: User Input
  • Task Description: Briefly describe the task completed.

Checklist Before Submitting:

  • [ yes] My code follows the repository folder structure.
  • [ yes] I have properly named my files and folders.
  • [ yes] I have documented my code where necessary.
  • [yes ] I have tested my solution and ensured it works as expected.

Additional Comments:

If any, mention here.

Copilot AI review requested due to automatic review settings February 9, 2026 10:31
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR submits Week 2 tasks, including a Day 3 “User Input” Rust CLI exercise (power options) and an additional Day 5 expense-tracker CLI with basic CRUD and file saving.

Changes:

  • Added Day 3 Rust CLI that parses a user-entered power option and prints the corresponding action.
  • Added Day 5 Rust expense tracker CLI with add/view/update/delete and persistence to a text file.
  • Added Cargo project scaffolding (Cargo.toml, Cargo.lock, .gitignore) for both submissions.

Reviewed changes

Copilot reviewed 9 out of 11 changed files in this pull request and generated 18 comments.

Show a summary per file
File Description
submissions/week-2/day-5/Stephen-Ngozi-Merkle-Tree/stephen_expences.txt Sample/generated saved output for the expense tracker.
submissions/week-2/day-5/Stephen-Ngozi-Merkle-Tree/src/tracker.rs Implements ExpenseTracker storage and file saving.
submissions/week-2/day-5/Stephen-Ngozi-Merkle-Tree/src/main.rs CLI menu + user input handling for expense tracker.
submissions/week-2/day-5/Stephen-Ngozi-Merkle-Tree/src/expense.rs Defines Expense and TransactionType.
submissions/week-2/day-5/Stephen-Ngozi-Merkle-Tree/Cargo.toml Cargo manifest for the Day 5 submission.
submissions/week-2/day-5/Stephen-Ngozi-Merkle-Tree/Cargo.lock Cargo lockfile for the Day 5 submission.
submissions/week-2/day-5/Stephen-Ngozi-Merkle-Tree/.gitignore Ignores Rust build output (target).
submissions/week-2/day-3/Stephen-Ngozi-User-Input/src/main.rs Day 3 CLI that maps user input to an enum and prints an action.
submissions/week-2/day-3/Stephen-Ngozi-User-Input/Cargo.toml Cargo manifest for the Day 3 submission.
submissions/week-2/day-3/Stephen-Ngozi-User-Input/Cargo.lock Cargo lockfile for the Day 3 submission.
submissions/week-2/day-3/Stephen-Ngozi-User-Input/.gitignore Ignores Rust build output (target).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


let new_expense = tracker.add(name, amount, tx_type);
println!(" Expense added successfully!");
println!("ID: {}, Name: {}, Amount: ${:.2}, Type: {:?}",
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This prints amount with $ here, but other flows (view/update) print Naria... for the amount. Pick one currency/format and keep it consistent across commands.

Suggested change
println!("ID: {}, Name: {}, Amount: ${:.2}, Type: {:?}",
println!("ID: {}, Name: {}, Amount: Naria{:.2}, Type: {:?}",

Copilot uses AI. Check for mistakes.
Comment on lines +76 to +80
println!("All Expenses");
for expense in expenses {
println!("ID: {} | Name: {} | Amount: Naria{:.2} | Type: {:?}",
expense.id, expense.name, expense.amount, expense.tx_type);
}
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This prints amount with Naria..., but the add flow prints $.... Pick one currency/format and keep it consistent across commands.

Copilot uses AI. Check for mistakes.
Comment on lines +108 to +110
if tracker.update(id, amount, tx_type){
println!("Expense Updated Successfu");

Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If tracker.update(...) returns false (ID not found), nothing is printed, so the user gets no feedback. Add an else branch to print a “not found” message.

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +3
mod expense;
mod tracker;

Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR metadata/title is for “Week 2 Day 3”, but this PR also adds a full Day 5 submission under submissions/week-2/day-5/.... If Day 5 work is intended, update the PR title/description; otherwise split into separate PRs.

Copilot uses AI. Check for mistakes.
Comment on lines +114 to +117
}else {
println!("Expense with ID {} not found!", id);

}
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After tracker.update(...) succeeds, the follow-up tracker.values.get(&id) should always return Some, making the else branch effectively unreachable. Consider having update return the updated expense (or Option<&Expense>) to avoid a second lookup and dead code.

Suggested change
}else {
println!("Expense with ID {} not found!", id);
}
}
} else {
println!("Expense with ID {} not found!", id);

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +2
ID: 2, Name: Beans, Amount: 5000.00, Type: Credit
ID: 1, Name: Rice, Amount: 20000.00, Type: Credit
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stephen_expences.txt looks like a runtime-generated output file (it’s created by save_to_file). Committing generated state makes future PRs noisy and can lead to merge conflicts; consider removing it from the submission and/or adding it to .gitignore (or writing under target//a dedicated data/ directory that is ignored).

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,6 @@
[package]
name = "Stephen-Ngozi-Merkle-Tree"
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cargo package names with uppercase letters (e.g., Stephen-Ngozi-Merkle-Tree) can produce warnings and are not accepted on crates.io. Consider using a lowercase, kebab-case name (e.g., stephen-ngozi-merkle-tree).

Suggested change
name = "Stephen-Ngozi-Merkle-Tree"
name = "stephen-ngozi-merkle-tree"

Copilot uses AI. Check for mistakes.
};

if tracker.update(id, amount, tx_type){
println!("Expense Updated Successfu");
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in success message: Successfu should be Successful.

Suggested change
println!("Expense Updated Successfu");
println!("Expense Updated Successful");

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants