Question

CAN SOMEONE COMPLETE THIS CODE PLEASE THNK YOU!! Question - Write a program in c++ that...

CAN SOMEONE COMPLETE THIS CODE PLEASE THNK YOU!!

Question - Write a program in c++ that keeps an appointment book. Make a class Appointment that stores a description of the appointment, the appointment day, the starting time, and the ending time. Your program should keep the appointments in a sorted vector. Users can add appointments and print out all appointments for a given day. When a new appointment is added, use binary search to find where it should be inserted in the vector. Do not add it if it conflicts with another appointment.

Create a class for Time and one for Date and use those for the data members.

This is what i have right now --

HEADER FILE

class Time
{
public:
/**
Constructor
Constructs a time of day
@param hour
@param min
*/
   Time(int hour=0, int min=0);
   /**
   accessor function to recieve hours
   @return hours
   */
   int get_hours() const;
   /**
   accessor function to recieve hours
   @return hours
   */
   int get_minutes() const;
   /**
   boolean fiunction to compare 2 times
   @param time - decide ifthis time is greater than the currant object
   @return true if greater
   */
   bool compare(Time time);
private:
   int time_in_minutes;
};

------------------------------------cpp file---------------------------------------

#include "catch.hpp"
#include "time.h"
Time::Time(int h, int m)
{time_in_minutes = h*60+m;}

int Time::get_hours() const
{return time_in_minutes/60;}

int Time::get_minutes() const
{return time_in_minutes%60;}

bool Time::compare(Time time)
{return time.time_in_minutes < time_in_minutes;}

TEST_CASE("Time")
{
   SECTION("TimeConstructor")
   {
       /**
       @test Check if constructor correctly set time
       if hour 2 and minutes is 5
       expect accessor functions
       to returnthose values
       @verbinclude results TimeConstructor
       */
       Time t(2,5);
       CHECK(t.get_hours() == 2);
       CHECK(t.get_minutes() == 5);
   }
   SECTION("get_hours")
   {
       /**
       @test Check if get_hours correctly returning
       if hour is 2 except accessor fucntion to return 2
       @verbinclude results TimeGet_hours
       */
       Time t1(0);
       CHECK(t1.get_hours() == 0);
       Time t2(12.5);
       CHECK(t2.get_hours() == 12);
       Time t3(5);
       CHECK(t3.get_hours() == 5);
   }
   SECTION("get_minutes")
   {
       CHECK(true);
   }
   SECTION("compare")
   {
       Time t1(12,5);
       CHECK(t1.get_hours() == 12,5);
       Time t2(5);
       CHECK(t2.get_hours() == 5);
       CHECK(t1.compare(t2)==true);
       CHECK(t1.compare(t2)==false);
   }
}

0 0
Add a comment Improve this question Transcribed image text
Answer #1

High level picture;:

CAppointment{

string desc;

CTime start;CTime end;

CDate date;

}

Function to add appointment:

std:: vector <Appointment>& add(std::vector<Appointment>& app)

{

std::string n_app:

//write code to input time,date and description for each Appointment.

std::cout<<"time date desc using CTime and CDate functions"

std::getline(std::cin,n_app);

app.push_back(n_app);

return app;

//this will give an high level picture of adding appointment in vector

}

now searching in binary tree:

search() function will require

1.input:appointment vector app

2.output:newvector newapp that will have inserted newapp.

search() functionality:

Add a comment
Know the answer?
Add Answer to:
CAN SOMEONE COMPLETE THIS CODE PLEASE THNK YOU!! Question - Write a program in c++ that...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • This is a simple C++ class using inheritance, I have trouble getting the program to work....

    This is a simple C++ class using inheritance, I have trouble getting the program to work. I would also like to add ENUM function to the class TeachingAssistant(Derived class) which is a subclass of Student(Derived Class) which is also a subclass of CourseMember(Base Class). The TeachingAssistant class uses an enum (a user-defined data type) to keep track of the specific role the TA has: enum ta_role {LAB_ASSISTANT, LECTURE_ASSISTANT, BOTH}; You may assume for initialization purposes that the default role is...

  • Write in C++ please In Chapter 10, the class clockType was designed to implement the time...

    Write in C++ please In Chapter 10, the class clockType was designed to implement the time of day in a program. Certain applications, in addition to hours, minutes, and seconds, might require you to store the time zone. Derive the class extClockType from the class clockTypeby adding a member variable to store the time zone. Add the necessary member functions and constructors to make the class functional. Also, write the definitions of the member functions and the constructors. Finally, write...

  • As you can see this was a solution to a problem if someone could go through...

    As you can see this was a solution to a problem if someone could go through line by line and explain to me especially the timeof day file that would help me alot.I am having trouble understanding the logic used with the first class of code time of day. A mutable encapsulation of the time during a day. public class TimeofDay private static final int SECONDS PER MINUTE = 60 private static final int MINUTES PER HOUR = 60 private...

  • C++ Please! Given this definition of a Time class: class Time { private: int hour, min,...

    C++ Please! Given this definition of a Time class: class Time { private: int hour, min, sec; public: Time() { hour = 0; min = 0; sec = 0; } Time(int h, int m, int s) {      hour = h; min = m; sec = s; } int getHour() const {     return hour; } int getMin() const {     return minute; } int getSec() const {     return sec; } }; Derive a class MilTime from the Time...

  • PLEASE COMPLETE IN C++ LANGUAGE Location row : int = -1 col : int = -1...

    PLEASE COMPLETE IN C++ LANGUAGE Location row : int = -1 col : int = -1 setLocation(row : int, col : int) getRow(): int getColl): int isEmpty(): bool Details Write all the code necessary to implement the Location class as shown in the UML Class Diagram to the right. Do this in a project named snake (we'll continue adding files to this project as the term progresses). Your class definition and implementation should be in separate files. When complete, you...

  • Greetings, everybody I already started working in this program. I just need someone to help me...

    Greetings, everybody I already started working in this program. I just need someone to help me complete this part of the assignment (my program has 4 parts of code: main.cpp; Student.cpp; Student.h; StudentGrades.cpp; StudentGrades.h) Just Modify only the StudentGrades.h and StudentGrades.cpp files to correct all defect you will need to provide implementation for the copy constructor, assignment operator, and destructor for the StudentGrades class. Here are my files: (1) Main.cpp #include <iostream> #include <string> #include "StudentGrades.h" using namespace std; int...

  • QUESTION: ADT stack: resizable array-based implementation    for Ch4 programming problem 4 "maintain the stacks's top...

    QUESTION: ADT stack: resizable array-based implementation    for Ch4 programming problem 4 "maintain the stacks's top entry at the end of the array" at array index N-1 where the array is currently allocated to hold up to N entries. MAKE SURE YOU IMPLEMENT the functions:  bool isEmpty() const; bool push(const ItemType& newEntry); bool pop(); in ArrayStackP4.cpp //FILE StackInterface.h #ifndef STACK_INTERFACE_ #define STACK_INTERFACE_ template<class ItemType> class StackInterface { public:    /** Sees whether this stack is empty.    @return True if the...

  • I need help with the code below. It is a C program, NOT C++. It can...

    I need help with the code below. It is a C program, NOT C++. It can only include '.h' libraries. I believe the program is in C++, but it must be a C program. Please help. // // main.c // float_stack_class_c_9_29 // // /* Given the API for a (fixed size), floating point stack class, write the code to create a stack class (in C). */ #include #include #include #include header file to read and print the output on console...

  • c++ Please create Set.cpp and Set.h The following information is needed (setinterface.h) Class Set You are...

    c++ Please create Set.cpp and Set.h The following information is needed (setinterface.h) Class Set You are given an interface: SetInterfac This is a public interface and completely specifies what the Set class operations must be. SetInterface is an abstract class (it has no implementation), so your Set class must inherit from SetInterface and implement all of its methods. Set differs in the fact that it does not allow duplicates. This also means that add()must check that an element is not...

  • This is for my c++ class and im stuck. Complete the Multiplex.cpp file with definitions for a fun...

    This is for my c++ class and im stuck. Complete the Multiplex.cpp file with definitions for a function and three overloaded operators. You don't need to change anything in the Multiplex.h file or the main.cpp, though if you want to change the names of the movies or concession stands set up in main, that's fine. Project Description: A Multiplex is a complex with multiple movie theater screens and a variety of concession stands. It includes two vectors: screenings holds pointers...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT