SlideShare una empresa de Scribd logo
1 de 3
Solve in c++ Programming:
Author the C++ class (both a.h file and a.cpp file) represented by the UML Class Diagram
shown below. |Create getter and setter methods shown below that interact with the private
members with matching names. WorldSeries WorldSeries(int year, string americanLeagueTeam,
string nationalLeagueTeam, string whoWon); string getWinner();//getter methods string
getLoser(); int getVear(); void setWinner(string winner);//setter methods void setLoser(string
loser); void setYear(int year); string my_Winner;//this series winning team string
my_Loser;//this series losing team int my_Year;//this cup's year
Solution
############ WorldSeries.h ################
#include<iostream>
using namespace std;
class WorldSeries{
private:
string my_Winner;
string my_Loser;
int my_Year;
public:
WorldSeries(int year, string americanLeagueTeam,
string nationalLeagueTeam, string whoWon);
string getWinner();
string getLoser();
int getYear();
void setWinner(string winner);
void setLoser(string loser);
void setYear(int year);
};
################ WorldSeries.cpp ###################
#include<iostream>
#include "WorldSeries.h"
using namespace std;
WorldSeries::WorldSeries(int year, string americanLeagueTeam,
string nationalLeagueTeam, string whoWon){
my_Winner = whoWon;
if(whoWon.compare(americanLeagueTeam) == 0)
my_Loser = nationalLeagueTeam;
else
my_Loser = americanLeagueTeam;
my_Year = year;
}
string WorldSeries::getWinner(){
return my_Winner;
}
string WorldSeries::getLoser(){
return my_Loser;
}
int WorldSeries::getYear(){
return my_Year;
}
void WorldSeries::setWinner(string winner){
my_Winner = winner;
}
void WorldSeries::setLoser(string loser){
my_Loser = loser;
}
void WorldSeries::setYear(int year){
my_Year = year;
}
int main(){
WorldSeries series(2016, "DDL","RPS", "DDL");
cout<<"Winner: "<<series.getWinner()<<endl;
return 0;
}

Más contenido relacionado

Similar a Solve in c++ Programming- Author the C++ class (both a-h file and a-cp.docx

15646254 c-balaguruswamy-solved-programs
15646254 c-balaguruswamy-solved-programs15646254 c-balaguruswamy-solved-programs
15646254 c-balaguruswamy-solved-programs
premrings
 
classes object fgfhdfgfdgfgfgfgfdoop.pptx
classes object  fgfhdfgfdgfgfgfgfdoop.pptxclasses object  fgfhdfgfdgfgfgfgfdoop.pptx
classes object fgfhdfgfdgfgfgfgfdoop.pptx
arjun431527
 
Please read this carefully needs to be in JAVA        Java 2D intr.pdf
Please read this carefully needs to be in JAVA        Java 2D intr.pdfPlease read this carefully needs to be in JAVA        Java 2D intr.pdf
Please read this carefully needs to be in JAVA        Java 2D intr.pdf
PRATIKSINHA7304
 

Similar a Solve in c++ Programming- Author the C++ class (both a-h file and a-cp.docx (19)

15646254 c-balaguruswamy-solved-programs
15646254 c-balaguruswamy-solved-programs15646254 c-balaguruswamy-solved-programs
15646254 c-balaguruswamy-solved-programs
 
TechTalk - Dotnet
TechTalk - DotnetTechTalk - Dotnet
TechTalk - Dotnet
 
Getters_And_Setters.pptx
Getters_And_Setters.pptxGetters_And_Setters.pptx
Getters_And_Setters.pptx
 
Preprocessor Programming
Preprocessor ProgrammingPreprocessor Programming
Preprocessor Programming
 
Core c sharp and .net quick reference
Core c sharp and .net quick referenceCore c sharp and .net quick reference
Core c sharp and .net quick reference
 
Core csharp and net quick reference
Core csharp and net quick referenceCore csharp and net quick reference
Core csharp and net quick reference
 
OpenGL L06-Performance
OpenGL L06-PerformanceOpenGL L06-Performance
OpenGL L06-Performance
 
Intake 38 3
Intake 38 3Intake 38 3
Intake 38 3
 
Csharp_Chap06
Csharp_Chap06Csharp_Chap06
Csharp_Chap06
 
classes object fgfhdfgfdgfgfgfgfdoop.pptx
classes object  fgfhdfgfdgfgfgfgfdoop.pptxclasses object  fgfhdfgfdgfgfgfgfdoop.pptx
classes object fgfhdfgfdgfgfgfgfdoop.pptx
 
The Ring programming language version 1.5.3 book - Part 58 of 184
The Ring programming language version 1.5.3 book - Part 58 of 184The Ring programming language version 1.5.3 book - Part 58 of 184
The Ring programming language version 1.5.3 book - Part 58 of 184
 
The Ring programming language version 1.5.3 book - Part 48 of 184
The Ring programming language version 1.5.3 book - Part 48 of 184The Ring programming language version 1.5.3 book - Part 48 of 184
The Ring programming language version 1.5.3 book - Part 48 of 184
 
Csharp_mahesh
Csharp_maheshCsharp_mahesh
Csharp_mahesh
 
Java swing
Java swingJava swing
Java swing
 
Please read this carefully needs to be in JAVA        Java 2D intr.pdf
Please read this carefully needs to be in JAVA        Java 2D intr.pdfPlease read this carefully needs to be in JAVA        Java 2D intr.pdf
Please read this carefully needs to be in JAVA        Java 2D intr.pdf
 
Lecture4
Lecture4Lecture4
Lecture4
 
Lecture4
Lecture4Lecture4
Lecture4
 
Cordovilla
CordovillaCordovilla
Cordovilla
 
Game Design and Development Workshop Day 1
Game Design and Development Workshop Day 1Game Design and Development Workshop Day 1
Game Design and Development Workshop Day 1
 

Más de rennaknapp

Json File - { -student_id-- 101- -first_name-- -James--.docx
Json File -   {     -student_id-- 101-     -first_name-- -James--.docxJson File -   {     -student_id-- 101-     -first_name-- -James--.docx
Json File - { -student_id-- 101- -first_name-- -James--.docx
rennaknapp
 
John plans to add a new operation Peek to the stackADT- This new opera.docx
John plans to add a new operation Peek to the stackADT- This new opera.docxJohn plans to add a new operation Peek to the stackADT- This new opera.docx
John plans to add a new operation Peek to the stackADT- This new opera.docx
rennaknapp
 

Más de rennaknapp (20)

Language is C++ I'm having trouble making my code meet these requireme.docx
Language is C++ I'm having trouble making my code meet these requireme.docxLanguage is C++ I'm having trouble making my code meet these requireme.docx
Language is C++ I'm having trouble making my code meet these requireme.docx
 
Land use changes and changing climatic conditions caused by human acti.docx
Land use changes and changing climatic conditions caused by human acti.docxLand use changes and changing climatic conditions caused by human acti.docx
Land use changes and changing climatic conditions caused by human acti.docx
 
Kimberly had to come up With a whictue data collection and analysis pr.docx
Kimberly had to come up With a whictue data collection and analysis pr.docxKimberly had to come up With a whictue data collection and analysis pr.docx
Kimberly had to come up With a whictue data collection and analysis pr.docx
 
Korb et al- (2000) obtained blood samples extracted fom patients infec.docx
Korb et al- (2000) obtained blood samples extracted fom patients infec.docxKorb et al- (2000) obtained blood samples extracted fom patients infec.docx
Korb et al- (2000) obtained blood samples extracted fom patients infec.docx
 
keep it simple pls Create a project named labExamCCCS221 containing fo.docx
keep it simple pls Create a project named labExamCCCS221 containing fo.docxkeep it simple pls Create a project named labExamCCCS221 containing fo.docx
keep it simple pls Create a project named labExamCCCS221 containing fo.docx
 
l Question 4 1 pts Gatekeeper tumor suppressor genes--- Encode prote.docx
l   Question 4 1 pts Gatekeeper tumor suppressor genes--- Encode prote.docxl   Question 4 1 pts Gatekeeper tumor suppressor genes--- Encode prote.docx
l Question 4 1 pts Gatekeeper tumor suppressor genes--- Encode prote.docx
 
L0-4 During 2022- Jenny- age 14- lives in a household with her father-.docx
L0-4 During 2022- Jenny- age 14- lives in a household with her father-.docxL0-4 During 2022- Jenny- age 14- lives in a household with her father-.docx
L0-4 During 2022- Jenny- age 14- lives in a household with her father-.docx
 
L0-7 In 2022- Jack- age 12 - has interest income of $4-900 on funds he.docx
L0-7 In 2022- Jack- age 12 - has interest income of $4-900 on funds he.docxL0-7 In 2022- Jack- age 12 - has interest income of $4-900 on funds he.docx
L0-7 In 2022- Jack- age 12 - has interest income of $4-900 on funds he.docx
 
Kyle is a student with an emotional behavioral disorder- He has also b.docx
Kyle is a student with an emotional behavioral disorder- He has also b.docxKyle is a student with an emotional behavioral disorder- He has also b.docx
Kyle is a student with an emotional behavioral disorder- He has also b.docx
 
Json File - { -student_id-- 101- -first_name-- -James--.docx
Json File -   {     -student_id-- 101-     -first_name-- -James--.docxJson File -   {     -student_id-- 101-     -first_name-- -James--.docx
Json File - { -student_id-- 101- -first_name-- -James--.docx
 
Make a concept map that shows the hierarchical relationship between th.docx
Make a concept map that shows the hierarchical relationship between th.docxMake a concept map that shows the hierarchical relationship between th.docx
Make a concept map that shows the hierarchical relationship between th.docx
 
Jordan and Alyssa are saving for their daughter Taylor's college educa.docx
Jordan and Alyssa are saving for their daughter Taylor's college educa.docxJordan and Alyssa are saving for their daughter Taylor's college educa.docx
Jordan and Alyssa are saving for their daughter Taylor's college educa.docx
 
John receives $3-400 from an investment at the beginning of every half.docx
John receives $3-400 from an investment at the beginning of every half.docxJohn receives $3-400 from an investment at the beginning of every half.docx
John receives $3-400 from an investment at the beginning of every half.docx
 
Many documents use a specific format for a person's name- Write a prog.docx
Many documents use a specific format for a person's name- Write a prog.docxMany documents use a specific format for a person's name- Write a prog.docx
Many documents use a specific format for a person's name- Write a prog.docx
 
Many crimes- like embezzlement- have definite trends- The demographic.docx
Many crimes- like embezzlement- have definite trends- The demographic.docxMany crimes- like embezzlement- have definite trends- The demographic.docx
Many crimes- like embezzlement- have definite trends- The demographic.docx
 
Management The consequences of unresolved conflict often have devastat.docx
Management The consequences of unresolved conflict often have devastat.docxManagement The consequences of unresolved conflict often have devastat.docx
Management The consequences of unresolved conflict often have devastat.docx
 
Make a star field as in Star Trek (the original series)- like MS's.docx
Make a star field as in Star Trek (the original series)- like  MS's.docxMake a star field as in Star Trek (the original series)- like  MS's.docx
Make a star field as in Star Trek (the original series)- like MS's.docx
 
MAKE a CONCEPT MAP illustrating how glycolysis- the Krebs-Citric acid.docx
MAKE a CONCEPT MAP illustrating how glycolysis- the Krebs-Citric acid.docxMAKE a CONCEPT MAP illustrating how glycolysis- the Krebs-Citric acid.docx
MAKE a CONCEPT MAP illustrating how glycolysis- the Krebs-Citric acid.docx
 
John plans to add a new operation Peek to the stackADT- This new opera.docx
John plans to add a new operation Peek to the stackADT- This new opera.docxJohn plans to add a new operation Peek to the stackADT- This new opera.docx
John plans to add a new operation Peek to the stackADT- This new opera.docx
 
John is a part of a team that has been gathered temporarily to develop.docx
John is a part of a team that has been gathered temporarily to develop.docxJohn is a part of a team that has been gathered temporarily to develop.docx
John is a part of a team that has been gathered temporarily to develop.docx
 

Último

1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
heathfieldcps1
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
SoniaTolstoy
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
PECB
 

Último (20)

1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 

Solve in c++ Programming- Author the C++ class (both a-h file and a-cp.docx

  • 1. Solve in c++ Programming: Author the C++ class (both a.h file and a.cpp file) represented by the UML Class Diagram shown below. |Create getter and setter methods shown below that interact with the private members with matching names. WorldSeries WorldSeries(int year, string americanLeagueTeam, string nationalLeagueTeam, string whoWon); string getWinner();//getter methods string getLoser(); int getVear(); void setWinner(string winner);//setter methods void setLoser(string loser); void setYear(int year); string my_Winner;//this series winning team string my_Loser;//this series losing team int my_Year;//this cup's year Solution ############ WorldSeries.h ################ #include<iostream> using namespace std; class WorldSeries{ private: string my_Winner; string my_Loser; int my_Year; public: WorldSeries(int year, string americanLeagueTeam, string nationalLeagueTeam, string whoWon); string getWinner(); string getLoser(); int getYear(); void setWinner(string winner); void setLoser(string loser);
  • 2. void setYear(int year); }; ################ WorldSeries.cpp ################### #include<iostream> #include "WorldSeries.h" using namespace std; WorldSeries::WorldSeries(int year, string americanLeagueTeam, string nationalLeagueTeam, string whoWon){ my_Winner = whoWon; if(whoWon.compare(americanLeagueTeam) == 0) my_Loser = nationalLeagueTeam; else my_Loser = americanLeagueTeam; my_Year = year; } string WorldSeries::getWinner(){ return my_Winner; } string WorldSeries::getLoser(){ return my_Loser; } int WorldSeries::getYear(){ return my_Year; } void WorldSeries::setWinner(string winner){ my_Winner = winner; } void WorldSeries::setLoser(string loser){ my_Loser = loser; } void WorldSeries::setYear(int year){ my_Year = year; } int main(){ WorldSeries series(2016, "DDL","RPS", "DDL");