Question

Create a C++ or Java program that will select students from the last attendance login to...

Create a C++ or Java program that will select students from the last attendance login to answer a question.

NOTE: program execution should include deletion and insertion of attendance information/element

Homework Answers

Answer #1

Program Code in C++ Screenshot



Program Sample Console Input/Output Screenshot



Program Code to Copy

#include <bits/stdc++.h>
using namespace std;

int main()
{
        //create a stack to store all elements in a last in first out system
        stack<string> list;
        // variable to take user choice in a menu driven program
        int choice;
        do
        {
                //print menu
                cout << "Enter option 1/2?" << endl;
                cout << "1. Login Student" << endl;
                cout << "2. Select a students from last attendance login." << endl;
                cout << "3. Exit." << endl;
                //take user input
                cin >> choice;
                if (choice == 1)
                {
                        //get login student name
                        cout << "Enter Student Name: ";
                        string name;
                        cin >> name;
                        //push stuent in stack
                        list.push(name);
                        //show message
                        cout << "Logged in student: " << name << endl;
                }
                else if (choice == 2)
                {
                        if (list.empty())
                        {
                                cout << "No student left to ask question" << endl;
                                continue;
                        }
                        //get student from the stack
                        string student = list.top();
                        //pop the stack
                        list.pop();
                        //show student selected
                        cout << "Selected student from last login: " << student << endl;
                }
        } while (choice != 3);
}
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
Assignment 2 Create a Java program called UserNames that reads the user's first and last name...
Assignment 2 Create a Java program called UserNames that reads the user's first and last name (separately), then prints a string composed of the first 4 letters of the user's last name, followed by the first letter of the user's first name, followed by a random number in the range of 10 to 99 (inclusive). You can assume the first name is at least one letter long and the last name is at least 4 letters. After doing this once,...
Objective: Write a Java program that will use a JComboBox from which the user will select...
Objective: Write a Java program that will use a JComboBox from which the user will select to convert a temperature from either Celsius to Fahrenheit, or Fahrenheit to Celsius. The user will enter a temperature in a text field from which the conversion calculation will be made. The converted temperature will be displayed in an uneditable text field with an appropriate label. Specifications Structure your file name and class name on the following pattern: The first three letters of your...
Assignment Overview This programming exercise introduces generics and interfaces. The students must create methods that accept...
Assignment Overview This programming exercise introduces generics and interfaces. The students must create methods that accept generic parameters and perform operation on them. Deliverables A listing of the fully commented, working source code of the Java program Test data for the code A screen shot of the application in execution Step 1 Create a new project. Name it "Assignment_2_1". Step 2 Build a solution. Write the Java source code necessary to build a solution for the problem below:You have just...
In C++ Create a program that uses only Selection Sort and Insertion Sort for the National...
In C++ Create a program that uses only Selection Sort and Insertion Sort for the National Football League list of current players Inputting data from a text file named "NFLplayers.txt" Only want the name of the player(first name then last name), their team name, and position they play. Example is: Patrick Mahomes, Chiefs, Quarterback Output lists to a text file along with how long it took to go through the Selection Sort and Insertion Sort and how many iterations it...
Write a complete Java program to solve the following problem. Read two positive integers from the...
Write a complete Java program to solve the following problem. Read two positive integers from the user and print all the multiple of five in between them. You can assume the second number is bigger than the first. For example if the first number is 1 and the second number is 10, then your program should output 5 10 Note: There is a white space in between the numbers. Java programming please answer ASAP before 2:30
Write C++ program to create a student record include a student ID, first name, nickname, course,...
Write C++ program to create a student record include a student ID, first name, nickname, course, subject, and subject marks. Task: Create a function to insert a number of students in the record. Create a function to print all student information by a table. Create a function to print all student information that they're in a specific course chosen by user input. Create a function to search for a student by student ID and print student information. Create a function...
Q: Design a program that lets the user enter the total rainfall for each of 12...
Q: Design a program that lets the user enter the total rainfall for each of 12 months into an array. The program should calculate and display the total rainfall for the year, the average monthly rainfall, and the months with the highest and lowest amounts. Create parallel arrays for the month names and rainfall amounts for each month. Use month names (i.e. January, February, March, etc.) when printing out the months with the highest and lowest amounts. Include a modular...
The following is for a Java Program Create UML Class Diagram for these 4 java classes....
The following is for a Java Program Create UML Class Diagram for these 4 java classes. The diagram should include: 1) All instance variables, including type and access specifier (+, -); 2) All methods, including parameter list, return type and access specifier (+, -); 3) Include Generalization and Aggregation where appropriate. Java Classes description: 1. User Class 1.1 Subclass of Account class. 1.2 Instance variables __ 1.2.1 username – String __ 1.2.2 fullName – String __ 1.2.3 deptCode – int...
WRITE A JAVA PROGRAM: The last digit of a credit card number is the check digit,...
WRITE A JAVA PROGRAM: The last digit of a credit card number is the check digit, which protects against transaction errors. The following method is used to veryfy credit card numbers. For the simplicity we can assume that the credit card has 8 digits instead of 16. Following steps explains the algorithm in determining if a credit card number is a valid card.  Starting from the right most digit, form the sum of every other digit. For example, if...
This is a Java program Program Description You work for a local cell phone company and...
This is a Java program Program Description You work for a local cell phone company and have been asked to write a program to calculate the price of a cell phone data plan being purchased by a customer. The program should do the following tasks: Display a menu of the data plans that are available to be purchased. Read in the user’s selection from the menu.  Input Validation: If the user enters an invalid option, the program should display an error...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT