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...

  • 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...

  • 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...

  • C++ language Please help. Create a small hospital system, where patients can book appointments. The program...

    C++ language Please help. Create a small hospital system, where patients can book appointments. The program should be able to take a patient’s information and the appointment that they’d like to book. It should also be able to display the patients names in order of their appointments (ascendingly). Your program should consist of: Class Person: with private variables name, ID and age. A default and a copy constructor, setters and getters and a print function. Class Patient: inherits from Person....

  • 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...

  • For this project you will be writing up a simple Clock program to keep track of...

    For this project you will be writing up a simple Clock program to keep track of time. SimpleClock.java - contains your implementation of the SimpleClock class. You will need to provide the code for a constructor as well as the mutator methods set and tick and the accessor method toString. Look at the comments for each method to see how they should be implemented - the trickiest method is probably tick, which requires that you deal with the changing of...

  • 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...

  • 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...

  • Study the c++ code below and answer the question on templates after // A polymorphic swap...

    Study the c++ code below and answer the question on templates after // A polymorphic swap function for any type of object (an example) template<typename T> void MySwap( T& x, T& y) { T temp; temp = x; x = y; y = temp; } // A polymorphic class holding an [x,y] position of any type template<class T> class Position { public: Position(T x=0, T y=0) : x_(x), y_(y) {} friend std::ostream& operator<<(std::ostream& os, const Position& p) { return os...

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