Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Documentation and Style - This is a large part of the grade on this assignment.

ID: 3596173 • Letter: D

Question

Documentation and Style - This is a large part of the grade on this assignment. See the "Documentation and Style Guidelines" document in the Lecture Notes Module. The TA will be checking for: Header and inline comments Indentation Spacing Use of blank lines C input and output You must use cin and cout. Use of scanf or printf is prohibited. Follow these conventions for identifiers: function names-start with lowercase letter, then use camel case variable names and data member names p-start with lowercase letter, then use camel case class names-start with uppercase letter, then use camel case · constants- all uppercase letters Follow convention for naming accessors and mutators. mutator-starts with lowercase "set" followed by, first letter capitalized, name of the data member accessor- starts with lowercase "get followed by, first letter capitalized, name of the data member Programs must declare ALL variables at the top of the function. C: The only exception is a variable that is used to control a for loop. int main (void // all variable declarations first // then executable statements Page 1

Explanation / Answer

time.h ------ > file

#ifndef _TIME_H
#define _TIME_H

class Time{
public:
unsigned int hour;
unsigned int minute;
unsigned int second;
Time();
Time(int,int,int);
void setHour(int);
void setMinute(int);
void setSecond(int);
int getHour();
int getMinute();
int getSecond();
void print();
void print12();
};

#endif

date.h ----- > file

#ifndef _DATE_H
#define _DATE_H

class Date{
public:
unsigned int day;
unsigned int month;
unsigned int year;
Date();
Date(int,int,int);
void setDay(int);
void setMonth(int);
void setYear(int);
int getDay();
int getMonth();
int getYear();
void print();
};

#endif

time.cpp ------ > file

#include<iostream>
#include "time.h"
#define H 00
Time::Time(int h,int m,int s){
setSecond(s);
setMinute(m);
setHour(h);
}
void Time::setHour(int h){
hour = h;
}
void Time::setMinute(int m){
minute = m;
}
void Time::setSecond(int s){
second = s;
}
int Time::getHour(){
return hour;
}
int Time::getMinute(){
return minute;
}
int Time::getSecond(){
return second;
}
void Time::print(){
std::cout<<hour<<":"<<minute<<":"<<second;
}
void Time::print12(){
int h;
if(hour > 12){
  h = 24 - hour;
}
else{
  h = hour;
}
std::cout<<h<<":"<<minute<<":"<<second;

}
Time::Time(){
hour = H;
minute = H;
second = H;
}

date.cpp --------- > file

#include<iostream>
#include "date.h"
#define D 1
#define Y 1980


Date::Date(){
day = D;
month = D;
year = Y;
}
Date::Date(int d,int m,int y){
setDay(d);
setMonth(m);
setYear(y);
}
void Date::setDay(int d){
day = d;
}
void Date::setMonth(int m){
month = m;
}
void Date::setYear(int y){
year = y;
}
int Date::getDay(){
return day;
}
int Date::getMonth(){
return month;
}
int Date::getYear(){
return year;
}
void Date::print(){
std::cout<<month<<"/"<<day<<"/"<<year;
}

calender.cpp ------------- > file

#include<iostream>
#include "time.h"
#include "date.h"

using namespace std;
int main(){
const int MAXT = 23,MAXS = 59;
int value;
Date d1[5];
Time t1[5];
for(int i =0 ;i<5;i++){
    t1[i] = Time(rand()%MAXT+1,rand()%MAXS+1,rand()%MAXS+1);
}
for(int i =0;i<5;i++){
  t1[i].print();
  cout<<endl;
}
for(int i =0;i<5;i++){
  t1[i].print12();
  cout<<endl;
}
for(int i =0;i<5;i++){
  cout<<" Enter the Day ";
  cin>>value;
  d1[i].setDay(value);
  cout<<" Enter The month ";
  cin>>value;
  d1[i].setMonth(value);
  cout<<" Enter The Year ";
  cin>>value;
  d1[i].setYear(value);
}
for(int i =0;i<5;i++){
  d1[i].print();
  cout<<endl;
}

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote