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

using C++ i am trying to make a class that displays a text file arranged like th

ID: 3834977 • Letter: U

Question

using C++ i am trying to make a class that displays a text file arranged like the example below. this is my code so far. it does not compile. please use the language C++.

EX:

Size: M

Gender: M

Color: R

Sleeve type: Ss

Fading: Y

Stretching: Y

Shrinking: N

Warming: Y

Reflecting: Y

Soaking: N

----------------------------------------------------------

#include <cstdlib>
#include <iostream>

using namespace std;
class shirt
{private:
char size;
char gender;
char color;
char sleeveType;
bool fading;
int stretch;
int shrinks;
int warms;
int reflect;
int soaks;

public:
char insertSize(char S, char M, char L)
{
size = s;
cout<<"Size: "<<size;
}
char insertGender(char M, char F)
{
gender = g;
cout<<"Gender: "<<gender;
}
char insertColor(char R, char Bl, char G, char p, char bk, char y, char br)
{
color = c;
cout<<"Color: "<<color;
}
char insertSleeveType(char Ss, char Ls, char Ns)
{
sleeveType = st;   
cout<<"Sleeve Type: "<<sleeveType;
}
bool insertFading(bool 1, bool 0)
{
fading = f;
cout<<"Fading?: "<<fading;
}
void insertStretch(int ls)
{
stretch = sr;
cout<<"Stretching?: "<<stretch;
}
void insertShrinks(int ss)
{
shrinks = sh;
cout<<"Shrinking?: "<<shrinks;
}
void insertWarms(int t)
{
warms = w;
cout<<"Warming up?: "<<warms;
}
void insertReflect( int l)
{
reflect = r;
cout<<"Reflecting light: "<<reflect;
}
void insertSoaks(int nw)
{
soak = sk;
cout<<"Soaking: "<<soaks;
}
  
int main()
{
shirt obj;
  
cout<<"Enter size of shirt :";
cin>>obj.size;
  
cout<<"Enter gender of shirt :";
cin>>obj.gender;
  
cout<<"Enter color of shirt :";
cin<<obj.color;
  
cout<<"Enter sleeve type :";
cin<<obj.sleeveType;
  
cout<<"Is the shirt fading? T/F:";
cin<<obj.fading;
  
cout<<"Is the object stretched? If so, by how much? :";
cin<<obj.stretch;
  
cout<<"Is you object shrinking? If so, by how much? :";
cin<<obj.shrinks;
  
cout<<"How much warmer is you
cin<<obj.
system("PAUSE");
return EXIT_SUCCESS;
}

Explanation / Answer

Hi, I have fixed all the issues.

It is working fine now.

Please let me know in case of any issue.


#include <cstdlib>
#include <iostream>
using namespace std;
class shirt
{
private:
char size;
char gender;
char color;
char sleeveType;
bool fading;
int stretch;
int shrinks;
int warms;
int reflect;
int soaks;

public:
void insertSize(char s)
{
size = s;
cout<<"Size: "<<size;
}
void insertGender(char g)
{
gender = g;
cout<<"Gender: "<<gender;
}
void insertColor(char c)
{
color = c;
cout<<"Color: "<<color;
}
void insertSleeveType(char st)
{
sleeveType = st;   
cout<<"Sleeve Type: "<<sleeveType;
}
void insertFading(bool f)
{
fading = f;
cout<<"Fading?: "<<fading;
}
void insertStretch(int ls)
{
stretch = ls;
cout<<"Stretching?: "<<stretch;
}
void insertShrinks(int ss)
{
shrinks = ss;
cout<<"Shrinking?: "<<shrinks;
}
void insertWarms(int t)
{
warms = t;
cout<<"Warming up?: "<<warms;
}
void insertReflect( int l)
{
reflect = l;
cout<<"Reflecting light: "<<reflect;
}
void insertSoaks(int nw)
{
soaks = nw;
cout<<"Soaking: "<<soaks;
}

friend ostream &operator<<( ostream &output, const shirt &s ) {

    output<<"Size: "<<s.size<<endl;
    output<<"Gender: "<<s.gender<<endl;
    output<<"Color: "<<s.color<<endl;
    output<<"Sleeve type: "<<s.sleeveType<<endl;
    output<<"Fading: "<<s.fading<<endl;
    output<<"Stretching: "<<s.stretch<<endl;
    output<<"Shrinking: "<<s.shrinks<<endl;
    output<<"Warming: "<<s.warms<<endl;
    output<<"Reflecting: "<<s.reflect<<endl;
    output<<"Soaking: "<<s.soaks<<endl;
return output;
}

};
  
int main()
{
shirt obj;
char size;
char gender;
char color;
char sleeveType;
bool fading;
int stretch;
int shrinks;
int warms;
int reflect;
int soaks;
  
cout<<"Enter size of shirt :";
cin>>size;
obj.insertSize(size);
  
cout<<"Enter gender of shirt :";
cin>>gender;
obj.insertGender(gender);
  
cout<<"Enter color of shirt :";
cin>>color;
obj.insertColor(color);
  
cout<<"Enter sleeve type :";
cin>>sleeveType;
obj.insertSleeveType(sleeveType);
  
cout<<"Is the shirt fading? T/F:";
cin>>fading;
obj.insertFading(fading);
  
cout<<"Is the object stretched? If so, by how much? :";
cin>>stretch;
obj.insertStretch(stretch);
  
cout<<"Is you object shrinking? If so, by how much? :";
cin>>shrinks;
obj.insertShrinks(shrinks);
  
cout<<"How much warmer is you? :";
cin>>warms;
obj.insertWarms(warms);

cout<<obj<<endl;;
system("PAUSE");
return EXIT_SUCCESS;
//return 0;
}