C++ Programming: From Problem Analysis To Program Design, Loose-leaf Version
8th Edition
ISBN: 9781337684392
Author: Malik, D. S.
Publisher: Cengage Learning
expand_more
expand_more
format_list_bulleted
Question
Chapter 8, Problem 17SA
Program Plan Intro
Program Plan:
- Include the header files for standard I/O operations.
- Inside the main() function, declare an integer array alpha with size 5 and initialize it with elements 3, 12, -25, and 72.
- Display the five elements of the array alpha using a for loop.
Program Description:
To declare an integer array alpha having size 5 with 4 elements and then display the five components of the integer array alpha.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
PROGRAMMING LANGUAGE: C++
You need to store hiring date and date of birth for teachers, and for students store their admission date and date of birth. You need to create a Date class for this purpose. Create objects of Date class in Teacher and Student class to store respective dates. You need to write print function in Teacher and Student classes as well to print all information of Teachers and Students. You need to perform composition to implement this task. Create objects of Teacher and Student classes in main function and call print function for both objects.
Print Date class here.
Print updated Teacher class here.
Print updated Student class here.
Print main function here.
Print Outputshere.
Programming Language: C++
Create an Abstract Data Type, which will store 2 integer number. After that, make operations which will set the value of the two numbers, add, subtract, multiply and divide. After creating the abstract data type, use it in the main class. Ask the user for the value of two integers. Ask the user what operation to use, then call the necessary operation based on the user's input. Then display the answer with the correct label.
Do not copy paste codes from other sites
C++ Code Dynamic Arrays
Chapter 8 Solutions
C++ Programming: From Problem Analysis To Program Design, Loose-leaf Version
Ch. 8 - Mark the following statements as true or false. A...Ch. 8 - Consider the following declaration: (1,2) double...Ch. 8 - Identify error(s), if any, in the following array...Ch. 8 - Determine whether the following array declarations...Ch. 8 - Prob. 5SACh. 8 - Write C+ + statement(s) to do the following: (1,...Ch. 8 - Prob. 7SACh. 8 - Prob. 8SACh. 8 - Prob. 9SACh. 8 - Prob. 10SA
Ch. 8 - Prob. 11SACh. 8 - Correct the following code so that it correctly...Ch. 8 - Prob. 13SACh. 8 - Suppose that points is an array of 10 components...Ch. 8 - Determine whether the following array declarations...Ch. 8 - Prob. 17SACh. 8 - Prob. 19SACh. 8 - Prob. 1PECh. 8 - Prob. 2PECh. 8 - Write a C+ + function, lastLargestIndex that takes...Ch. 8 - Write a program that reads a file consisting of...Ch. 8 - Prob. 6PECh. 8 - Write a program that allows the user to enter the...Ch. 8 - Write a program that uses a two-dimensional array...Ch. 8 - Prob. 12PECh. 8 - Write a program to calculate students average test...
Knowledge Booster
Similar questions
- Programmig language = OOP Language = C++ You have to write a program to store information of university students. There can be many students in university, so you can make a Student class and objects of class Student to store information. The university is interested in storing information about student’s name, enrollment, department, class, CGPA and gender. You can store this information as data member values for each object. But as you already know you cannot directly access data members of a class, so you need to make member functions to access data members. You can make as many member functions as you want. There are no restrictions. The University is interested in knowing the student’sname with highest CGPA in a specific class. For example if you entered information of 10 students from class BSIT 2 and information of 5 students from class BSIT 3, and it is asked to find name of student with highest CGPA in BSIT 2 then your program must be able to find details of highest CGPA…arrow_forwardin C++ Write a function that allows you to modify a Planet in the SolarSystem class. You can choose to pass a Planet into this function, or have the function prompt for planet information. Either way, you need to be able to specify the Planet at a specific index to be modified. This is an example of how it could potentially look in the main: // code that declared a SolarSystem the_system// and assigned planetsPlanet p("X", 2000, 4000);int index = 2;the_system.changePlanet(p, index);arrow_forwardPROGRAMMING LANGUAGE :C++ QUESTION; You need to store hiring date and date of birth for Managers and Employees. You need to create a Date class for this purpose. Create objects of Date class in Manager and Employee classes to store respective dates. You need to write print function in Manager and Employee classes as well to print all information of Managers and Employees. You need to perform composition to implement this task. Create objects of Manager and Employee classes in main function and call print function for both objects. ______________________________________________________________ note : print the specific part of code in following ... Print Date class here: Print updated Manager class here: Print updated Employee class here: Print main function here:arrow_forward
- Language : C++ Subject : OOP Suppose we have a class Rectangle which has two data members, length and width. In addition, there should be a static variable, namely allRectanglesTotalArea which stores the area of all the Rectangles created. Furthermore, there should be a function named calcRectangleArea() which calculates the area of rectangle and adds it to the allRectanglesTotalArea. Write a static function nameddisplayAllRectanglesTotalArea()which displays the value of allRectanglesTotalArea. The main function of the program should look like the following. intmain() { Rectangle r1(5.0,4.0); r1.calcRectangleArea(); Rectangle r2(2.5,4.0); r2.calcRectangleArea(); Rectangle::displayAllRectanglesTotalArea(); return 0; }arrow_forwardConsider the function void modify(int & x) { x = 10; }Show how to call the modify function so that it sets the integer int i;to 10.arrow_forwardIn c++, please and thank you! Write a function that dynamically allocates an array of integers. The function should accept an integer argument indicating the number of elements to allocate. The function should return a pointer to the array.arrow_forward
- javascript only: This quarter, your team manager is awarding commission to anyone who closes a sale worth $15,000 or more! The commission amount will be 10% of the value of their largest sale. Anyone who does not make this large of a sale will receive the base commission of $500. Write a function `salesCommission(arr)` that takes an array of objects containing salesperson names and their largest sale, and returns the total amount of commission money that needs to be paid out to the team. Example: salespeople = [ { name: "Susan", largestSale: 3000 }, { name: "Brianna", largestSale: 20000 }, { name: "Dwayne", largestSale: 13000 }, { name: "Delilah", largestSale: 26000 }, { name: "Fernando", largestSale: 8000 }, ]; console.log(salesCommission(salespeople)); // 6100arrow_forwardLanguage: C++ Use the previously given files: Critter.h, Critter.cpp and testcritter.cpp. Expand Critter.h by two additional properties of your choice, and corresponding setter and getter methods, then adjust Critter.cpp and testcritter.cpp accordingly. Also adapt the print () method such that the new properties are printed on the screen as well. You can assume that the input will be valid.arrow_forwardProgramming Language: C++ Make a program wherein you have to create an Abstract Data Type, which will store 2 integer number. After that, make operations which will set the value of the two numbers, add, subtract, multiply and divide. After creating the abstract data type, use it in the main class. Ask the user for the value of two integers. Ask the user what operation to use, then call the necessary operation based on the user's input. Then display the answer with the correct label. Do not copy paste codes from other sites.arrow_forward
- The following describes the difference between void and NULL pointers: Make proper use of examples to bolster your argument.arrow_forwardIn C++ Write the definition of a void function that has two parameters: an array, and an integer parameter that specifies the number of elements in the array. The functions swaps the first and last elements of the array.arrow_forward: You have to write a program to store information of university students. There can be many students in university, so you can make a Student class and objects of class Student to store information. The university is interested in storing information about student’s name, enrollment, department, class, CGPA and gender. You can store this information as data member values for each object. But as you already know you cannot directly access data members of a class, so you need to make member functions to access data members. You can make as many member functions as you want. There are no restrictions. The University is interested in knowing the student’s name with highest CGPA in a specific class. For example if you entered information of 10 students from class BSIT 2 and information of 5 students from class BSIT 3, and it is asked to find name of student with highest CGPA in BSIT 2 then your program must be able to find details of highest CGPA student from only BSIT 2. The university is…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education