1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
andrew11 [14]
2 years ago
12

Need help with python coding

Computers and Technology
2 answers:
Ivanshal [37]2 years ago
7 0

Answer:

def= definition

Explanation:

Gekata [30.6K]2 years ago
7 0
Def means definition
You might be interested in
Design and implement a class dayType that implements the day of the week in a program. The class dayType should store the day, s
olya-2409 [2.1K]

#include<iostream>

#include<string>

usingnamespace std;

void menu(); //declartion of function to show the menu

classdayType//creating the class

{

      string Wdays[7];

      int i;

      string day;

      string prDay;

      string NxtDay;

      string AddDays;

public:

      dayType(string);//constructor with one parameter

      string setday(); //declartion of function to set the day

      string preday(); // declartion of function to find privious day

      void Nextday(); // declartion of function to find Next day

      string add(int n); // declartion of function to find after addingthenumber of days given by the user

      void print(); // declartion of function to print the result

};

int main()

{

      int n;

      string d;

      menu(); //displaying menu

      cout <<"Enter the day :";

      getline(cin, d); //Takes the day from the user

      dayType Da(d); //creating an object of a class

      Da.setday();

      Da.preday();

      Da.Nextday();

      cout <<"Enter the No. of days to add :";

      while (!(cin >> n) ||n<0) { //validation checking

                    cin.clear();

                    cin.ignore(999, '\n');

                    cout <<"Invalid data type! \nPlease enter No. of daysto add again :";

             

      }

      Da.add(n);

      Da.print();

      system("pause");

      return 0;

}

dayType::dayType(stringi) :day(i){ //Defintion of a constructor with one parameter

      Wdays[0] = "Mon";

      Wdays[1] = "Tues";

      Wdays[2] = "Wednes";

      Wdays[3] = "Thurs";

      Wdays[4] = "Fri";

      Wdays[5] = "Satur";

      Wdays[6] = "Sun";

}

stringdayType::setday() //Function to set the day

{

      if (day == Wdays[0])

      {

             i = 0;

      }

      elseif (day == Wdays[1])

      {

             i = 1;

      }

      elseif (day == Wdays[2])

      {

             i = 2;

      }

      elseif (day == Wdays[3])

      {

             i = 3;

      }

      elseif (day == Wdays[4])

      {

             i = 4;

      }

      elseif (day == Wdays[5])

      {

             i = 5;

      }

      elseif (day == Wdays[6])

             i = 6;

      else

      {

             day = "Invalid Input";

             i = 7;

      }

      return day;

}

stringdayType::preday() //Function to find the preivous day

{

      if (i == 0)

             prDay = Wdays[6];

      elseif (i == 7)

             prDay = "Invalid Input";

      else

             prDay = Wdays[i - 1];

      return prDay;

}

voiddayType::Nextday() //Function to find Next day

{

      if (i == 6)

             NxtDay = Wdays[0];

      elseif (i == 7)

             prDay = "Invalid Input";

      else

             NxtDay = Wdays[i + 1];

}

stringdayType::add(intn) // function to find after adding the number of days given by the user

{

      n = n + i;

      while (n>= 7)

      {

             n = n - 7;

      }

      if (i == 7)

             Wdays[n] = "Invalid Input ";

      return AddDays = Wdays[n];

}

voiddayType::print()

{

      cout << endl <<"\tDay="<< day <<"day"<< endl;

      cout <<"\tPrevious day :"<< prDay <<"day"<< endl;

      cout <<"\tNext day :"<< NxtDay <<"day"<< endl;

      cout <<"\tAfter Adding Days :"<< AddDays <<"day"<< endl;

}

void menu() //Function to display menu

{

      cout <<"******************MENU********************"<< endl;

      cout <<"\tEnter 'Sun' for 'Sunday'"<< endl;

      cout <<"\tEnter 'Mon' for 'Monday'"<< endl;

      cout <<"\tEnter 'Tues' for 'Tuesday'"<< endl;

      cout <<"\tEnter 'Wednes' for 'Wednesday'"<< endl;

      cout <<"\tEnter 'Thurs' for 'Thursday'"<< endl;

      cout <<"\tEnter 'Fri' for 'Friday'"<< endl;

      cout <<"\tEnter 'Satur' for 'Saturday'"<< endl;

8 0
3 years ago
When you include a word cover page in a multi page document, the cover page is not considered the first page. True or false?
____ [38]
It ture on the cover page include
4 0
2 years ago
Why should you stay out of the open space to the right of a semi tractor trailer?
dimulka [17.4K]
The right side to a semi tractor trailer is their huge blind side, meaning the driver can't see you, and may merge lanes with you, thus crashing into you.
5 0
2 years ago
Read 2 more answers
Who can help me on my school we will to google meet and i share my screen
Deffense [45]
Me ......................
7 0
3 years ago
Which formulas would work to combine cells with first, middle, and last names from columns A through C and row 2 into a new cell
AURORKA [14]

Split? not really sure but i understand a bit of this..

6 0
3 years ago
Read 2 more answers
Other questions:
  • Suppose that you created an robot that was so advanced it could act independently in very complex situations. It made its own de
    9·1 answer
  • How is marketing related to the other functions of a business
    14·1 answer
  • The methods in a subclass can use all of the data fields and methods that belong to its parent, with one exception: ____ members
    11·1 answer
  • You are a database administrator. Chantelle comes to you asking for help on how to access all the data in one row of the databas
    11·1 answer
  • To change the name of a field, press and hold or right-click the column heading for the field, tap or click ____ on the shortcut
    7·1 answer
  • PLZ help
    5·1 answer
  • Modify the NumberedList class we implementd during the lecture by adding a member function: void NumberedList::insertPosition(in
    13·1 answer
  • Susan works for a company that values their employees me and deadlines in finding ways to keep the cost of doing business low wh
    12·1 answer
  • Question 2 of 3
    7·2 answers
  • Hello my name is Phoenix I will like for you to friend me on Ro blox my user name is Jessiahcoleman and if u play BLOX fruits or
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!