Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help programming this in c++. Can I see the output of it. our company has been asked to develop a program for the

I need help programming this in c++. Can I see the output of it.

our company has been asked to develop a program for the Brain Readiness Academic Training Institute (BRATI) that will help their BRATI elementary students learn the order of United States Presidents as well as some information about them. Write a C++ console application that performs the tasks as spelled out below:

In this project, you will implement a bag class that will store a vector of presidents. The Program will display a president name and then ask you what the presidential number is. For example, "What is the presidential number of BarackObama?". Your reply should be 44. At that point in time the program will display:

Time he lived

date he took office

date he left office

his party

previous office held

the name of his vice president

If you type an incorrect value for the presidential number, the program will display an error message and the correct presidential number, incorrect responses and total guesses.

The User will click -1 to exit the program if they do not want to continue guessing presidential numbers.

Your program should use ASCII colors to set background and foreground (font) colors to reflect correct and incorrect responses. See FAQ #8 for details.

Files You Will Create:

Presidents.h - there is an attached copy of Presidents.h that you can us as a start to organize your variables and methods. You will either use as is or modify it.

Presidents.cpp - fully define methods defined in Presidents.h

PresidentsGame.cpp - will create a stack of the president class, show a "game" menu and return information to user. (See below for output examples.)

Presidents.h should contain everything you need to store and access president data. Note the overloaded functions (methods in OOP terminology) at the bottom of the header file. Take a look at how the baccount.cpp file implemented the == operator on page 329. You will be doing something similar. There is also something new, friend functions. In general a friend function is not part of the class but has access to the class private data. Like the neighbor that feels free to walk into your house and get a beer out of the refrigerator without asking. ;) You can look up "C++ friends function" on the Internet.

The main program main function should be an infinite loop that puts out instructions and sets the game in motion. Here are some possible functions you can use to help break things apart:

void instructions(); void totals(int& correctRef, int &wrongRef); void loadPresidents(Set & bagOfPresidents); int getGuess(Presidents& pres); void getTerm(int rand); // this is a little extra, one president ran in two different nonconsecutive terms, // see if you can figure out how to identify his terms void playPresidents();

Again, these are just suggestions, this is your program, so you can break it apart however you want.

it will read from Presidentdatabase.text

0 President Birth-Death Took office Left office Party Previous office Vice President 1 George Washington (1732 to 1799) April 30, 1789 March 4, 1797 Independent Commander-in-Chief; of the Continental Army (1775 to 1783) John Adams 2 John Adams (1735 to 1826) March 4, 1797 March 4, 1801 Federalist Vice President Thomas Jefferson 3 Thomas Jefferson (1743 to 1826) March 4, 1801 March 4, 1809 Democratic-Republican Vice President 1st term: Aaron Burr / 2nd term: George Clinton 4 James Madison (1751 to 1836) March 4, 1809 March 4, 1817 Democratic-Republican Secretary of State (1801 to 1809) George Clinton: 03/04/1809-04/20/1812; vacant: 04/20/1812 to 03/04/1813; Elbridge Gerry: 03/04/1813 to 11/23/1814; vacant: 11/23/1814 to 03/04/1817 5 James Monroe (1758 to 1831) March 4, 1817 March 4, 1825 Democratic-Republican Secretary of State (1811 to 1817) Daniel D. Tompkins 6 John Quincy Adams (1767 to 1848) March 4, 1825 March 4, 1829 Democratic-Republican Secretary of State (1817 to 1825) John C. Calhoun 7 Andrew Jackson (1767 to 1845) March 4, 1829 March 4, 1837 Democratic U.S. Senator (1823 to 1825) John C. Calhoun: 03/04/1829 to 12/28/1832; then Martin Van Buren 8 Martin Van Buren (1782 to 1862) March 4, 1837 March 4, 1841 Democratic Vice President Richard Mentor Johnson 9 William Henry Harrison (1773 to 1841) March 4, 1841 April 4, 1841 Whig Minister to Colombia (1828 to 1829) John Tyler 10 John Tyler (1790 to 1862) April 4, 1841 March 4, 1845 Whig: 04/04/1841 to 09/13/1841; no party: 09/13/1841 to 04/04/1845 Vice President vacant: no vice president 11 James K. Polk (1795 to 1849) March 4, 1845 March 4, 1849 Democratic Governor of Tennessee (1839 to 1841) George M. Dallas 12 Zachary Taylor (1784 to 1850) March 4, 1849 July 9, 1850 Whig U.S. Army Major general Millard Fillmore 13 Millard Fillmore (1800 to 1874) July 9, 1850 March 4, 1853 Whig Vice President vacant: no vice president 14 Franklin Pierce (1804 to 1869) March 4, 1853 March 4, 1857 Democratic U.S. Senator (1837 to 1842) William R. King: 03/04/1853 to 04/18/1853; vacant: no vice president 15 James Buchanan (1791 to 1868) March 4, 1857 March 4, 1861 Democratic United States Minister; to the United Kingdom (1853 to 1856) John C. Breckinridge 16 Abraham Lincoln (1809 to 1865) March 4, 1861 April 15, 1865 Republican U.S. Representative (1847 to 1849) Hannibal Hamlin : Andrew Johnson 17 Andrew Johnson (1808 to 1875) April 15, 1865 March 4, 1869 Democratic; National Union; no party Vice President vacant: no vice president 18 Ulysses S. Grant (1822 to 1885) March 4, 1869 March 4, 1877 Republican Commanding General of the Army (1864 to 1869) Schuyler Colfax; Henry Wilson 03/04/1873 to 09/22/1875; vacant: no vice president 19 Rutherford B. Hayes (1822 to 1893) March 4, 1877 March 4, 1881 Republican Governor of Ohio (1868 to 1872 & 1876 to 1877) William A. Wheeler 20 James A. Garfield (1831 to 1881) March 4, 1881 September 19, 1881 Republican U.S. Representative Chester A. Arthur 21 Chester A. Arthur (1829 to 1886) September 19, 1881 March 4, 1885 Republican Vice President vacant: no vice president 22 Grover Cleveland (1837 to 1908) March 4, 1885 March 4, 1889 Democratic Governor of New York (1883 to 1885) Thomas A. Hendricks: 03/04/1885 to 11/25/1885; vacant: no vice president 23 Benjamin Harrison (1833 to 1901) March 4, 1889 March 4, 1893 Republican U.S. Senator (1881 to 1887) Levi P. Morton 24 Grover Cleveland (1837 to 1908) March 4, 1893 March 4, 1897 Democratic President (1885 to 1889) Adlai Stevenson I 25 William McKinley (1843 to 1901) March 4, 1897 September 14, 1901 Republican Governor of Ohio (1892 to 1896) Garret Hobart: 03/04/1897 to 09/21/1899; vacant: no vice president; Theodore Roosevelt 26 Theodore Roosevelt (1858 to 1919) September 14, 1901 March 4, 1909 Republican Vice President vacant: no vice president; Charles W. Fairbanks 27 William Howard Taft (1857 to 1930) March 4, 1909 March 4, 1913 Republican Secretary of War (1904 to 1908) James S. Sherman: 03/04/1909 to 08/30/1912; vacant: no vice president 28 Woodrow Wilson (1856 to 1924) March 4, 1913 March 4, 1921 Democratic Governor of New Jersey (1911 to 1913) Thomas R. Marshall 29 Warren G. Harding (1865 to 1923) March 4, 1921 August 2, 1923 Republican U.S. Senator (1915 to 1921) Calvin Coolidge 30 Calvin Coolidge (1872 to 1933) August 2, 1923 March 4, 1929 Republican Vice President Charles G. Dawes 31 Herbert Hoover (1874 to 1964) March 4, 1929 March 4, 1933 Republican Secretary of Commerce (1921 to 1928) Charles Curtis 32 Franklin D. Roosevelt (1882 to 1945) March 4, 1933 April 12, 1945 Democratic Governor of New York (1929 to 1932) John Nance Garner; Henry A. Wallace; Harry S. Truman 33 Harry S. Truman (1884 to 1972) April 12, 1945 January 20, 1953 Democratic Vice President Alben W. Barkley 34 Dwight D. Eisenhower (1890 to 1969) January 20, 1953 January 20, 1961 Republican Supreme Allied Commander Europe (1949 to 1952) Richard Nixon 35 John F. Kennedy (1917 to 1963) January 20, 1961 November 22, 1963 Democratic U.S. Senator (1953 to 1960) Lyndon B. Johnson 36 Lyndon B. Johnson (1908 to 1973) November 22, 1963 January 20, 1969 Democratic Vice President Hubert Humphrey 37 Richard Nixon (1913 to 1994) January 20, 1969 August 9, 1974 Republican Vice President (1953 to 1961) Spiro Agnew: January 20, 1969 to October 10, 1973; vacant: no vice president: October 10, 1973 to December 6, 1973; Gerald Ford: December 6, 1973 to August 9, 1974 38 Gerald R. Ford (1913 to 2006) August 9, 1974 January 20, 1977 Republican Vice President vacant: no vice president; Nelson Rockefeller: 12/19/1974 to 01/20/1977 39 Jimmy Carter (b.1924) January 20, 1977 January 20, 1981 Democratic Governor of Georgia (1971 to 1975) Walter Mondale 40 Ronald Reagan (1911 to 2004) January 20, 1981 January 20, 1989 Republican Governor of California (1967 to 1975) George H. W. Bush 41 George H. W. Bush (b.1924) January 20, 1989 January 20, 1993 Republican Vice President Dan Quayle 42 Bill Clinton (b.1946) January 20, 1993 January 20, 2001 Democratic Governor of Arkansas; (1979 to 1981 & 1983 to 1992) Al Gore 43 George W. Bush (b.1946) January 20, 2001 January 20, 2009 Republican Governor of Texas (1995 to 2000) Richard Cheney 44 Barack Obama (b.1961) January 20, 2009 Incumbent(January 20, 2016) Democratic U.S. Senator (2005 to 2008) Joe Biden 45 Donald J. Trump (b.1946) January 20, 2017 Incumbent(January 20, 2025) Republican None Mike Pence

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

More Books

Students also viewed these Databases questions

Question

What are the classifications of Bank?

Answered: 1 week ago

Question

Use a three-step process to develop effective business messages.

Answered: 1 week ago