Need help with the flow chart of this program
#include
#include
using namespace std;
string months[] = {"January","February
","March","April","May","June","July","August","September","October","November","December"};
int days_in_months[] = {31,28,31,30,31,30,31,31,30,31,30,31};
class Date //Sample Class for the C++ Tutorial
{
private:
int month; //Data member
int day; // Data member
int year;
public:
Date(int m, int d, int y)
{
if(m<1 || m >12)
month = 1;
else
month = m;
if(d<1 || d >days_in_months[month-1])
day = 1;
else
day = d;
if(y<2001)
year = 2001;
else
year = y;
}
~Date()
{
}
void printDate1()
{
cout << this->month << "/" << this->day
<< "/" << this->year << "\n";
}
void printDate2()
{
cout << months[month-1] << " " << day << ",
" << year << endl;
}
void printDate3()
{
cout <};
int main(void)
{
int tempMonth = 0 ;
int tempDay = 0;
int tempYear = 0;
while(tempMonth > 12 || tempMonth < 1)
{
cout << "Input a month 1 through 12 and press enter:
\n";
cin >> tempMonth;
}
while(tempDay > days_in_months[tempMonth-1] || tempDay <
1)
{
cout << "Input a Day 1 through "<<
days_in_months[tempMonth-1] << " and press enter: \n";
cin >> tempDay;
}
while(tempYear < 1)
{
cout << "Input a Year (assuming we do not count leap year):
\n";
cin >> tempYear;
}
Date *d = new Date(tempMonth,tempDay,tempYear);
d->printDate1();
d->printDate2();
d->printDate3();
return 0;
}
We need at least 10 more requests to produce the answer.
0 / 10 have requested this problem solution
The more requests, the faster the answer.
Need help with the flow chart of this program #include #include using namespace std; string months[]...
#include "stdafx.h" #include <iostream> using namespace std; class dateType { private: int dmonth; int dday; int dyear; public: void setdate (int month, int day, int year); int getday()const; int getmonth()const; int getyear()const; int printdate()const; bool isleapyear(int year); dateType (int month=0, int day=0, int year=0); }; void dateType::setdate(int month, int day, int year) { int numofdays; if (year<=2008) { dyear=year;...
Write a psuedocode for this program. #include <iostream> using namespace std; string message; string mappedKey; void messageAndKey(){ string msg; cout << "Enter message: "; getline(cin, msg); cin.ignore(); //message to uppercase for(int i = 0; i < msg.length(); i++){ msg[i] = toupper(msg[i]); } string key; cout << "Enter key: "; getline(cin, key); cin.ignore(); //key to uppercase for(int i = 0; i < key.length(); i++){ key[i] = toupper(key[i]); } //mapping key to message string keyMap = ""; for (int i = 0,j...
Flow chart of this
program
#include <iostream> #include <cmath> using namespace std; int mainO double sum=0.0, ave-ee, int locmx, locmn int n; cout <<"Enter the number of students: "<<endl; cin >> ni double listln]; double max-0; double min-e; for (int i-e ; i<n ;i++) cout<s enter the gpa: "<cendli cin>>listli]; while (listlile i listli1>4) cout<s error,Try again "<cendl; cin>listlil: sun+=list[i]; N1 if (listli]>max) for(int isin itt) max=list [i]; 10cmx=1+1 ; else if (list [i] min) min=list [i]; locmn-i+1; ave sum/n;...
#include<iostream> #include<string> #include<iomanip> using namespace std; /* ********* Class Car ************* ********************************* */ class Car { private: string reportingMark; int carNumber; string kind; bool loaded; string choice; string destination; public: Car() { reportingMark = ""; carNumber = 0; kind = "Others"; loaded = 0; destination = "NONE"; } ~Car() { } void setUpCar(string &reportingMark, int &carNumber, string &kind, bool &loaded, string &destination); }; void input(string &reportingMark, int &carNumber, string &kind, bool &loaded,string choice, string &destination); void output(string &reportingMark, int &carNumber,...
please help me fix the error in here #include<iostream> #include <string> using namespace std; string getStudentName(); double getNumberExams(); double getScoresAndCalculateTotal(double E); double calculateAverage(double n, double t); char determineLetterGrade(); void displayAverageGrade(); int main() { string StudentName; double NumberExam, Average, ScoresAndCalculateTotal; char LetterGrade; StudentName = getStudentName(); NumberExam = getNumberExams(); ScoresAndCalculateTotal= getScoresAndCalculateTotal(NumberExam); Average = calculateAverage(NumberExam, ScoresAndCalculateTotal); return 0; } string getStudentName() { string StudentName; cout << "\n\nEnter Student Name:"; getline(cin, StudentName); return StudentName; } double getNumberExams() { double NumberExam; cout << "\n\n Enter...
#include <iostream> #include <cstdlib> #include <time.h> #include <string> using namespace std; int main() { srand(time (0)); int number, guess, response, reply; int score = 0 number = rand() % 100 + 1; do { do { cout << "Enter your guess "; cin >> guess; score++; if (guess < number) cout << guess << " is too low! Enter a higher number. "; else if (guess > number) cout << guess << " is too high! Enter a lower number....
//Vehicle.h
#pragma once
#include<iostream>
#include"Warranty.h"
#include<string>
using namespace std;
class Vehicle{
protected:
string make;
int year;
double mpg;
Warranty warranty;
static int numOfVehicles;
public:
Vehicle();
Vehicle(string s, int y, double m, Warranty
warranty);
Vehicle(Vehicle& v);
~Vehicle();
string getMake();
int getYear();
double getGasMileage();
void setMake(string s);
void setYear(int y);
void setYear(string y);
void setGasMileage(double m);
void setGasMileage(string m);
void displayVehicle();
static int getNumVehicles();
Warranty getWarranty();
void setWarranty(Warranty& );
};
//Vehicle.cpp
#include "Vehicle.h"
#include <string>
Vehicle::Vehicle()
{
make = "unknown";
year =...
This is C++ code for parking fee management program #include <iostream> #include <iomanip> using namespace std; void input(char& car, int& ihour,int& imin, int& ohour, int& omin); void time(char car, int ihour, int imin, int ohour, int omin, int& phour, int& pmin, int& round, double& total); void parkingCharge (char car, int round, double& total); void print(char car, int ihour, int imin, int ohour, int omin, int phour, int pmin, int round, double total); int main() { char car; int ihour; int...
// P13_2.cpp - This program adds money of two different people #include<iostream> #include<cstdlib> using namespace std; class AltMoney { public: AltMoney(); AltMoney(int d, int c); friend void add(AltMoney m1, AltMoney m2, AltMoney& sum); void display_money( ); private: int dollars; int cents; }; void read_money(int& d, int& c); int main( ) { int d, c; AltMoney m1, m2, sum; sum = AltMoney(0,0); read_money(d, c); m1 = AltMoney(d,c); cout...
Please help the out keeps printing twice
#include
#include
#include
#include
#include
using namespace std;
/**
* Function to calculate the future value and return the same
*/
double calculateFutureValue(double presentValue, double
interestRate, int months)
{
double futureValue = (double)presentValue * pow((1 +
interestRate), months);
return futureValue;
}
/**
* Function to read the input file and assign the value to the
variables
*/
unsigned int readfile(ifstream &inF, double &presentValue,
double &interestRate, int &months)
{
inF >>...