Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program to help a user automate its to-do list. The program should do the following: Show the user the different actions they can

Write a program to help a user automate its to-do list. The program should do the following:

  1. Show the user the different actions they can perform on the list (add, remove tasks, display task...).
  2. Allow the user to select one of the actions.
  3. Calculate and print the bill

The to-do list will be read from the file:

Name of the task Due date (mm dd yyyy) Priority

Learn basic Python 12 12 2021 3

Implement a snake game 04 01 2021 1

Clean up my room 01 10 2021 2

Build my resume 12 12 2021 3

Study for the exam 03 05 2021 1

Learn how to juggle 05 06 2022 3

Create a website using React 12 07 2021 2

Have a tea and self-reflect 03 01 2021 2

Modify the existing code. Use an array, tasks, of the struct Task, with three components: name of the type string, dueDay, dueMonth, dueYear of type double, isCompleted of type bool, and priority of type int. Your program must contain at least the following functions:

  • (20 points) Function getData: This function loads the data from a file named tasks.txt with the above items into the array tasks.
  • Function viewTasks: This function shows the list of all to-do items with due date and status.
  • (20 points) Function addTasks: This function will add one new task to the to-do list. If no more space display a message No more space.
  • (20 points) Function completeTask: This function will mark the chosen task as completed.
  • (20 points) Function removeTask: This function will remove one task from the list.
  • (10 points) Function sortTasks: This function will sort the list by dueDate. (extra credit)
  • (20 points) Function taskSummary: This function displays the number of tasks in the to-do list and the percentage of tasks completed

Sample output is:

Summary of Johnnys To-Do List

Total number of tasks 8

Percentage completed 25%

** write in C++ please!!

Only have this part please help finish it

#include #include #include #include using namespace std; struct Task { char name[10]; int dueDay; int dueMonth; int dueYear; bool isComplete = false; int priority; }; enum Actions {stop, view}; void viewTasks(Task [], int); int main() {

const int MAX_SIZE = 5; Task tasks[MAX_SIZE]; int numOfTasks = 0; int action;

//---------------------read from a file-------------------- do { cout << " Please enter your task's name: "; cin >> tasks[numOfTasks].name; cout << "Please enter your task's due date (day month year): "; cin >> tasks[numOfTasks].dueDay >> tasks[numOfTasks].dueMonth >> tasks[numOfTasks].dueYear; cout << "Please enter your task's priority (1-high, 2-moderate, 3-low): "; cin >> tasks[numOfTasks].priority; numOfTasks++;

cout << "Do you want to add another task? (0-no, 1-yes): "; cin >> action; } while (action != stop); // the code above should be replaced by getData function call (read from a file) cout << "-------All tasks has been added.------- ";

do { cout << " Menu:" << endl; cout << "0 - exit" << endl; cout << "1 - view tasks" << endl; cout << "2 - remove a task" << endl; cout << "3 - add a tasks" << endl; cout << "4 - mark task as completed" << endl; cout << "What would you like to do next? Enter a number: "; cin >> action;

switch (action) { case stop: cout << "Thank you for choosing Anderson Inc. Hope to see you soon!" << endl; break; case view: viewTasks(tasks, numOfTasks); break; } } while (action != stop); return 0;

} void viewTasks(Task tasks[], int size) { string result = "not completed";

for (int i = 0; i < size; i++) { cout << " -------Task " << i + 1 << "-----------" << endl; cout << "Name: " << tasks[i].name << endl; cout << "Due date: " << tasks[i].dueDay << '/' << tasks[i].dueMonth << '/' << tasks[i].dueYear << endl; cout << "Priority: " << tasks[i].priority << endl; if (tasks[i].isComplete) result = "completed"; cout << "Status: " << result << endl; } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spatio Temporal Database Management International Workshop Stdbm 99 Edinburgh Scotland September 10 11 1999 Proceedings Lncs 1678

Authors: Michael H. Bohlen ,Christian S. Jensen ,Michel O. Scholl

1999th Edition

3540664017, 978-3540664017

More Books

Students also viewed these Databases questions