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
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...
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...
C++ PROGRAM. (C++ INTRO QUESTION) Write a program that prints the count of all prime numbers...
C++ PROGRAM. (C++ INTRO QUESTION) Write a program that prints the count of all prime numbers between A and B (inclusive), where A and B are defined as follows: A = 55000 B = A + 5000 Just a recap on prime numbers: A prime number is any number, greater or equal to 2, that is divisible ONLY by 1 and itself. Here are the first 10 prime numbers: 2, 5, 7, 11, 13, 17, 19, 23, and 29. Rules:...
Create a ShoppingCart class in java that simulates the operation of a shopping cart. The ShoppingCart...
Create a ShoppingCart class in java that simulates the operation of a shopping cart. The ShoppingCart instance should contain a BagInterface implementation that will serve to hold the Items that will be added to the cart. Use the implementation of the Item object provided in Item.java. Note that the price is stored as the number of cents so it can be represented as an int (e.g., an Item worth $19.99 would have price = 1999). Your shopping cart should support...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT