Question

c++ 5.(10) a.                 Now define an array of type TVSpecs to hold 50 TVs and name...

c++

5.(10) a.                 Now define an array of type TVSpecs to hold 50 TVs and name the array TVShoppe.

   (10) b.                Write the code to count how many TVs in the array TVShoppe that are with smart remotes and are priced less than $1,000.

Homework Answers

Answer #1

ANSWER : HERE IS THE ANSWER FOR YOUR QUESTION:

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

               CODE:


#include <iostream>

using namespace std;


// defining the structure for the TVSpecs structure
struct TVSpecs
{
//screen_size as integer variable
int screen_size;
// string type variable as remote_type to hold data
string remote_type;
// float data type for storing the TV_price
float TV_price;
};


int main()
{
// 5(a) --> declaring the array TVShoppe of size 50 of type TVSpecs
TVSpecs TVShoppe[50];
  
// 5(b)
int count=0;
for(int i=0;i<50;i++)
{
if(TVShoppe[i].remote_type=="smart" && TVShoppe[i].TV_price <=1000 )
{
count++;
}
}
  
  
  
}

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

SNIPPET:

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

OUTPUT:

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

I hope this would help you out.

If you like my answer , please upvote

If you have any doubt, you can provide comment /feedback below the answer

Thanks

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
c++ (10) a.                    I have some data that represents information about TVs. The data for a...
c++ (10) a.                    I have some data that represents information about TVs. The data for a TVs is the screen size, a ‘dumb’ or ‘smart’ remote and TV price. Define a structure (TVSpecs) that will hold the data described above for one TV.    (5) b. Now define a variable myTV that is of type TVSpecs
For questions 1 and 2 declare the array size as name constant first then use it...
For questions 1 and 2 declare the array size as name constant first then use it to declare the array 1. Declare an array named scores of type double and size 30. 2. Declare an array named names of string objects and size 15 3. Given the following array definition: int values[] = {2, 5, 8, 11}; What does each of the following display? cout << values[1];         B) cout << value[3]+values[0];   Define a three element array named letters, initialize it...
Write a C++ program to perform the following tasks     a) Declare an integer array of...
Write a C++ program to perform the following tasks     a) Declare an integer array of size 1000.     b) Initialize the array with random values between 1 and 9.     c) Write the code to find and print, how many 1’s occur in the array.
In this program, you should define an array of 10 elements in your data segment with...
In this program, you should define an array of 10 elements in your data segment with these values: ? = {11, 12,−10, 13, 9, 12, 14, 15,−20, 0} a. Write a function which finds the maximum value of this array. b. Write another function which calculates the summation of this array. c. Call these functions in your main program, and print the outputs of these functions to the user i. “The maximum is 15” ii. “The summation is 56” d....
Write JavaScript codes that count how many As, Bs, Cs in the following scores array, and...
Write JavaScript codes that count how many As, Bs, Cs in the following scores array, and calculate the average of the scores (Note: you can’t hard code the computation) A range >=90; 90>B range >=80; 90> C range >=70
Lab 6    -   Program #2   -   Write one number to a text file. Use the write()...
Lab 6    -   Program #2   -   Write one number to a text file. Use the write() and read() functions with binary                                                        data, where the data is not char type.              (Typecasting is required) Fill in the blanks, then enter the code and run the program. Note:   The data is int type, so typecasting is            required in the write() and read() functions. #include <iostream> #include <fstream> using namespace std; int main() {    const int SIZE = 10;   ...
C program question: Write a small C program connect.c that: 1. Initializes an array id of...
C program question: Write a small C program connect.c that: 1. Initializes an array id of N elements with the value of the index of the array. 2. Reads from the keyboard or the command line a set of two integer numbers (p and q) until it encounters EOF or CTL - D 3. Given the two numbers, your program should connect them by going through the array and changing all the entries with the same name as p to...
Programming in C: 1. Given the following variable declarations: const size_t n = 50; 2. Write...
Programming in C: 1. Given the following variable declarations: const size_t n = 50; 2. Write the declaration of an an array of pointers to n memory blocks containing 16-bit signed integer values. Use 'x' for the name of the variable. 3. What is the type of the variable x? uint8_t *x[256]; 4. What type does the variable x decay to when used in an expression? uint8_t *x[256] 5. What is the data type of an array of five strings?...
A variable has a number of attributes including but not limited to name, value and type....
A variable has a number of attributes including but not limited to name, value and type. Please note not every variable has a name. Given the following code, please (1) find total number of variables, and (2) for each of the variables give out the name, type, and value info (if a value is a memory address just write ‘addr’.), e.g. Variable 1: name (cv1), type (int), value (5).    int cppMethod () {                                 //C++ like code                            static int cv1...
In the following C code, Which variable if NOT of primitive data type? A. a B....
In the following C code, Which variable if NOT of primitive data type? A. a B. b C. c D. d int a = 10; double b = 20.0; float c = false; char d[5] = "Hello"; // here we define a string In programming language C, the implementation of a string data type is limited dynamic length, which means the length of a string variable is fixed once it has been defined. A. True B. False In C# programming...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT