Problem Solving with C++ (10th Edition)
Problem Solving with C++ (10th Edition)
10th Edition
ISBN: 9780134448282
Author: Walter Savitch, Kenrick Mock
Publisher: PEARSON
bartleby

Concept explainers

bartleby

Videos

Textbook Question
Book Icon
Chapter 13, Problem 5PP

A harder version of Programming Project 4 would be to write a class named List, similar to Project 4, but with all the following member functions:

■    Default constructor, List();

■    double List::front();f which returns the first item in the list

■    double List::back();, which returns the last item in the list

■    double List::current();t which returns the “current" item

■    void List::advance();t which advances the item that current() returns

■    void List::reset(); to make current() return the first item in the list

■    void List::insert(double afterMe, double insertMe);, which inserts insertMe into the list after afterMe and increments the private: variable count.

■    int size();which returns the number of items in the list

■    friend istream& operator <<(istream& ins, double writeMe);

 The private data members should include the following:

  node* head;

  node* current;

  int count;

 and possibly one more pointer.

 You will need the following struct (outside the list class) for the linked list nodes:

  struct node

  {

  double item;

  node *next;

  };

 Incremental development is essential to all projects of any size, and this is no exception. Write the definition for the List class, but do not implement any members yet. Place this class definition in a file list.h. Then #include “list.h” in a file that contains int main(){}.Compile your file. This will find syntax errors and many typographical errors that would cause untold difficulty if you attempted to implement members without this check. Then you should implement and compile one member at a time, until you have enough to write test code in your main function.

Blurred answer
Students have asked these similar questions
Activity - Abstract Class An English teacher wants to find assessment mark of all the students in his course. Write a java program to find assessment mark of the students using following instructions. Save the project/file as StudentAbstract. A) Abstract Class name: Assessment Abstract Member Method: - to calculate and return total score totalScore() B) Class name: English extends Assessment Member variables: QuizMark, PracticeTest, ListeningMark Member Method : - Constructor to initialize member variables - to calculate and return total score totalScore QuizMark + PracticeTest*0.25 + %3D ListeningMark/2 C) Controlling class : StudentAbstract - To create an object of English class - To print totalScore of the English
Programming Language = Python 1. Employee and ProductionWorker Classes Write an Employee class that keeps data attributes for the following pieces of information: • Employee name • Employee number Next, write a class named ProductionWorker that is a subclass of the Employee class. The ProductionWorker class should keep data attributes for the following information: • Shift number (an integer, such as 1, 2, or 3) • Hourly pay rate The workday is divided into two shifts: day and night. The shift attribute will hold an integer value representing the shift that the employee works. The day shift is shift 1 and the night shift is shift 2. Write the appropriate accessor and mutator methods for each class. Once you have written the classes, write a program that creates an object of the ProductionWorker class and prompts the user to enter data for each of the object’s data attributes. Store the data in the object and then use the object’s accessor methods to retrieve it and display it on the…
Lab Goal : This lab was designed to teach you more object oriented programming and start you down the path of creating larger programs and games like BlackJack and Elevens [ one of the new AP CS A Labs ]. You will create a Deck class that contains a List < Card >Lab Description : You need to design a class that contains an instance variables which is a List < Card > and an int that keeps track of the top card position . You then need to make a constructor and related methods. You will need a dealCard method and a shuffle method. Use the template shown below.      /make a Deck classpublic static final int NUMCARDS = 52;public static String[] SUITS = "CLUBS HEARTS DIAMONDS SPADES".split(" ");private List<Card> cards;private int top;//make a Deck constructor//refer cards to new ArrayList//set top to the top of the deck 51//loop through all suits//loop through all faces 1 to 13//add a new BlackJackCard to the deck//make a dealCard() method that returns the top card//write…
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
What is Abstract Data Types(ADT) in Data Structures ? | with Example; Author: Simple Snippets;https://www.youtube.com/watch?v=n0e27Cpc88E;License: Standard YouTube License, CC-BY