Specify design and implement a class that can be used in a p

Specify design and implement a class that can be used in a program that simulates a combination lock. The lock has a circular knob with the numbers 0 through 39 marked on the edge and it has a three-number combination, which we\'ll call x, y, z. To open the lock, you must turn the knob counter clockwise stopping the second time that knob clockwise again, stop ping the next time that z appears at the top. At this point, you may open the lock. Your lock class should have a constructor that initializes the three-number combination (use 0.0.0 for it fault arguments) Also provide member functions. to alter the lock\'s combination to a new three-number combination I to turn the knob in a given direction until a specified number appears at the lop to close the lock to attempt to open the lock lo impure about the status of the lock (open or shut) to tell you what number is currently at the top Specify, design, ami implement a class called statistician. After a statistician is initialized, it can be given a sequence of double numbers. Each number in the sequence is given lo the statistician by activating a member function called next_number, for example, we can declare a statistician called s. and then give ill the sequence of numbers 1.1, -2.4.0.8 as shown here: Overload the + operator to allow you to add two statisticians from the previous project. If s1 and s2 are two statisticians, then the result of s1 + s2 should be a new statistician that behaves as if it had all of the numbers of is followed by all of the numbers of s2. Specify, design, and implement a class for a card m a deck of playing cards. The object should contain methods for setting and retrieving the suit and rank of a card. been given to a statistician, there are various member functions to obtain information about the sequence. Include member fine. Specify, design, and implement a class that can used to keep track of the position of a point in three-dimensional space. For example, consider the point drawn at the top of the next three coordinates:

Solution

#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<stdio.h>
using namespace std;

class Statistician
{
public:
   Statistician()
   {
       length = 0;
       min = 0;
       max = 0;
       first = 0;
       last = 0;
       sum = 0;
       average = 0;
       cout << \"Statistician class is initialized\" << endl;
   }

   void next_number(double nextnum)
   {
       if (length == 0)
       {
           min = nextnum;
           max = nextnum;
           first = nextnum;
           last = nextnum;
           sum = nextnum;
           length = 1;
           return;
       }

       if (nextnum < min)
           min = nextnum;
  
       if (nextnum > max)
           max = nextnum;
  
       length++;
       sum = sum + nextnum;
       last = nextnum;
   }


   void erase_sequence()
   {
       length = 0;
       min = 0;
       max = 0;
       first = 0;
       last = 0;
       sum = 0;
       average = 0;
       cout << \"Statistician class object is erased\" << endl;
   }
   int getLength()
   {
       return length;
   }

   double getFirst()
   {
       if (length == 0)
       {
           cout << \"Sequence is Empty\" << endl;
           return 0;
       }
       else
           return first;
   }

   double getLast()
   {
       if (length == 0)
       {
           cout << \"Sequence is Empty\" << endl;
           return 0;
       }
       else
           return last;
   }

   double getMinNumber()
   {
       if (length == 0)
       {
           cout << \"Sequence is Empty\" << endl;
           return 0;
       }
       else
           return min;
   }

   double getMaxNumber()
   {
       if (length == 0)
       {
           cout << \"Sequence is Empty\" << endl;
           return 0;
       }
       else
           return max;
   }

   double getSum()
   {
       return sum;
   }

   double getAverage()
   {
       if (length == 0)
       {
           cout << \"Sequence is Empty\" << endl;
           return 0;
       }
       else
           return sum/length;      
   }

private:
   int length;
   double min;
   double max;
   double first;
   double last;
   double smallest;
   double largest;
   double sum;
   double average;
};


void TC(Statistician &s1)
{
   cout << \"getLength is: \" << s1.getLength() << endl;
   cout << \"getFirst is: \" << s1.getFirst() << endl;
   cout << \"getLast is: \" << s1.getLast() << endl;
   cout << \"getMinNumber is: \" << s1.getMinNumber() << endl;
   cout << \"getMaxNumber is: \" << s1.getMaxNumber() << endl;
   cout << \"getSum is: \" << s1.getSum() << endl;
   cout << \"getAverage is: \" << s1.getAverage() << endl;
   cout << endl;
}

int main()
{
   Statistician s1;

   s1.next_number(1.2);
   s1.next_number(1.1);
   s1.next_number(2.1);
   s1.next_number(2.2);
   s1.next_number(3.1);
   s1.next_number(3.23);
   TC(s1);
  
   Statistician s2;
   s2.next_number(1.1);
   s2.next_number(-2.4);
   s2.next_number(0.8);
   TC(s2);

   s2.erase_sequence();
   TC(s2);
  
   return 0;

}

 Specify design and implement a class that can be used in a program that simulates a combination lock. The lock has a circular knob with the numbers 0 through 3
 Specify design and implement a class that can be used in a program that simulates a combination lock. The lock has a circular knob with the numbers 0 through 3
 Specify design and implement a class that can be used in a program that simulates a combination lock. The lock has a circular knob with the numbers 0 through 3
 Specify design and implement a class that can be used in a program that simulates a combination lock. The lock has a circular knob with the numbers 0 through 3

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site