Question

In: Computer Science

Create a program with the features: NEEDED IN C++. Keywords: has object, passing object 1) Implement...

Create a program with the features: NEEDED IN C++.

Keywords: has object, passing object

1) Implement a classnamed StarWars; Class StarWarshas a classnamed World;

2) The object starWarsOBJcreated the Class Moonas a tool that Darth Vader uses to control the Class World; Therefore, having the object worldOBJwithin your starWarsOBJ, pass the object moonOBJ as an argument to the worldOBJ;

3) The moonOBJhas a huge tower that is represented as the struct data_tower towercomprised of: int total_antennas,float *sending_signal, string message.

4) Create the method Inputasking the user what is the value for total_antennas, and then make the dynamic allocation of your array of float sending_signal[total_antennas], using the commands new and delete accordingly;

5) Run a simulation showing for each hour the sending_signal[total_antennas], is sending the string messagethat is printed on worldOBJthe following phrase, as ordered by Darth Vader: “... Darth Vader is the Great!...”. This message is repeated for each of the sending_signal[total_antennas], i.e. if you have 10 antennas, the message will be repeated 10 antennas x 24 hours a day; when printing the message, inform also what is the current time step in the simulator and which antenna is sending the signal.

Solutions

Expert Solution


ANSWER :

Program in C++

#include<iostream>
#include<string>
using namespace std;
class Moon //Here is the Moon class having struct data_tower- Part 3
{
   public:
       struct data_tower
       {
           int total_antennas;
           float *sending_signal;
           string message;          
       };
      
       data_tower tower1; //variable of data_tower type
};

class StarWars //Here is the class StarWars Part 1
{
    public:
        class World // Inner class World in StarWars class
        {
              public:
                
        };
      
        World worldOBJ(Moon moonOBJ); // Passing object of Moon class as argument Part 2
};

int main()
{
   int totalAntennas;
   Moon moonOBJ;
  
   cout<<"Enter the value of total_antennas"<<endl; //taking total_antennas as input from user Part 4
   cin>>totalAntennas;
  
   moonOBJ.tower1.total_antennas = totalAntennas;  
   moonOBJ.tower1.sending_signal = new float[moonOBJ.tower1.total_antennas]; // dynamically allocating float array
  
}

( PLEASE VOTE FOR THIS ANSWER )

I THINK IT WILL BE USEFULL TO YOU .......

PLZZZZ COMMENT IF YOU HAVE ANY PROBLEM I WILL TRY TO SOLVE IT .....

THANK YOU ...............


Related Solutions

Implement a program as an object using a class (abstract data type) in C++ that does...
Implement a program as an object using a class (abstract data type) in C++ that does the following: 1) reads the firstName, lastName and 3 test scores of at least five students. 2) calculate student test score totals, average, letter grade for each student. 3) Display the results in a table format showing firstName, lastName, test1, test2, test3, total, average, letterGrade, of all the students. 3 files .h, .cpp, main.cpp create an object that can hold records. must get records...
C++ program homework question 1 1. Create and implement a class called clockType with the following...
C++ program homework question 1 1. Create and implement a class called clockType with the following data and methods (60 Points.): Data: Hours, minutes, seconds Methods: Set and get hours Set and get minutes Set and get seconds printTime(…) to display time in the form of hh:mm:ss default and overloading constructor Overloading Operators: << (extraction) operator to display time in the form of hh:mm:ss >> (insertion) operator to get input for hours, minutes, and seconds operator+=(int x) (increment operator) to...
MUST BE DONE IN C (NOT C++) Your create a program that can implement the cases...
MUST BE DONE IN C (NOT C++) Your create a program that can implement the cases in which the initial unit is Fahrenheit or something not recognizable. Your program should incorporate Fahrenheit to Celsius, Fahrenheit to Kelvin and unknown initial units (display an error message for this last one). You must use functions to calculate Fahrenheit degrees.
In C create a program that stores contact info. The program must have the following features:...
In C create a program that stores contact info. The program must have the following features: Able to store First Name, Phone Number and Birthday (MM/DD/YYYY) Able to search for a specific contact using First Name, Phone Number and Birthday (find) Able to delete a specific contact using First Name, Phone Number and Birthday (delete) Print entire contact list Show number of entries in contact list Able to save Contact List to file (save) Able to load Contact List from...
Kindly Do the program in C++ language Object Oriented Programming. Objectives  Implement a simple class...
Kindly Do the program in C++ language Object Oriented Programming. Objectives  Implement a simple class with public and private members and multiple constructors.  Gain a better understanding of the building and using of classes and objects.  Practice problem solving using OOP. Overview You will implement a date and day of week calculator for the SELECTED calendar year. The calculator repeatedly reads in three numbers from the standard input that are interpreted as month, day of month, days...
C language Write a program in C to implement Queue and its operation (like create, insert,...
C language Write a program in C to implement Queue and its operation (like create, insert, delete, search) using array data structure.
A simple c program is needed to create encrypt and decode social security numbers. Then a...
A simple c program is needed to create encrypt and decode social security numbers. Then a validation must be used to make sure there are no invalid numbers. **********************************************C PROGRAMMING********************************************************************************* char social[][12] = {"164-55-0726","948-44-1038","193-74-0274","458-57-2867","093-00-1093","159-56-9731","695-21-2340","753-66- 6482","852-73-4196","648-81-1456","879-61-1829","123-87-0000","000-65-3197","741-85-9632","963-25-7418"}; Create a function that will accept as input a properly formatted social security number. Then increment each digit by one. If the digit is "9" then make it a "0". Return a properly formatted social security number. Then create a function that will do the...
WRITE A C++ PROGRAM TO IMPLEMENT THE CONCEPT OF INDEX (Create index in text file)
WRITE A C++ PROGRAM TO IMPLEMENT THE CONCEPT OF INDEX (Create index in text file)
Separate code into .cpp and .h files: // C++ program to create and implement Poly class...
Separate code into .cpp and .h files: // C++ program to create and implement Poly class representing Polynomials #include <iostream> #include <cmath> using namespace std; class Poly { private: int degree; int *coefficients; public: Poly(); Poly(int coeff, int degree); Poly(int coeff); Poly(const Poly& p); ~Poly(); void resize(int new_degree); void setCoefficient(int exp, int coeff); int getCoefficient(int exp); void display(); }; // default constructor to create a polynomial with constant 0 Poly::Poly() { // set degree to 0 degree = 0; //...
PLEASE DO IN C++ Create an object-oriented program that initially allows the user to save customer...
PLEASE DO IN C++ Create an object-oriented program that initially allows the user to save customer information in the list and to search for a customer by specifying the customer’s ID. Sample Run Customer Information Management System --------------------------------------------------------------- CUSTOMER DATA ENTRY: Full Name (First, Last): Jenny Ha Company: Convergent Laser Technologies Street: 1000 International Ave City: Oakland State: CA Zip Code: 94506 ID: 100 Continue Your Data Entry? (y/n): y Full Name (First, Last): Bill Martinez Company: Cisco Systems Street:...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT