Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

We have been tasked to implement a program/application that makes learning algeb

ID: 3589952 • Letter: W

Question

We have been tasked to implement a program/application that makes learning algebra fun! This program will ask the student if they want to solve an addition, multiplication, subtraction, division, or random one-variable equation. The student is in an elevator and trying to get all the way to the top floor of a building for the gold prize by solving each equation correctly and moving up or down floors based on their answer! You will ask the student how many floors there are in the building to start, and when the student solves the equation correctly, they get to go up one floor closer to the gold. If the user solves the equation incorrectly, then they go down one floor. After the student solves the equation, you must re-prompt the student for which type of equation they want solve again (addition, multiplication, subtraction, division, or random), until they reach the gold on the top floor of the building. The numbers in the equations are between 0-100 (inclusive), and you will generate one number for the expression and one number for the solution/right side of the equation. After the student reaches the gold, you must ask the student if they want to play again. You must always inform the user which level of the building they are on with a message and ASCII art!!! You must insert a blank line between re-prompting the student with a new equation to solve. If the student wins and wants to play again, you must ask how many floors are in the new building. (help with starting)

Explanation / Answer

Note : Code is in c++.

#include <iostream>
#include<stdio.h>
using namespace std;

int main() {
char p = 'Y'; //Play or not
while(p == 'Y') {
int no_floors,curr_floor = 0;
   cout<<"How many floors in the building?"<<endl;
   cin>>no_floors;
   string type = "";

   while(curr_floor!=no_floors) {
cout<<"Which type of equation?"<<endl;
cin>>type;
int a = rand()%101;
int result = rand()%101;
cout<<"expression:"<<a<<endl;
cout<<"solution:"<<result<<endl;
int inp;
   if(type == "addition") {
   int b = result-a;
   cin>>inp;
   if(inp==b) {
   curr_floor++;
   }
   else if(curr_floor!=0) {
   curr_floor--;
   }
   }
   else if(type == "subtraction") {
   int b = result+a;
   cin>>inp;
   if(inp==b) {
   curr_floor++;
   }
   else if(curr_floor!=0) {
   curr_floor--;
   }
   }
   else if(type == "division") {
   int b = result*a;
   cin>>inp;
   if(inp==b) {
   curr_floor++;
   }
   else if(curr_floor!=0) {
   curr_floor--;
   }
   }
   else if(type == "multipication") {
   int b = result/a;
   cin>>inp;
   if(inp==b) {
   curr_floor++;
   }
   else if(curr_floor!=0) {
   curr_floor--;
   }
   }
   else {
   int random_no = rand()%4;
   if(random_no==0) {
   cout<<"addition"<<endl;
   int b = result-a;
   cin>>inp;
   if(inp==b) {
   curr_floor++;
   }
   else if(curr_floor!=0) {
   curr_floor--;
   }
   }
   else if(random_no==1) {
   int b = result+a;
   cin>>inp;
   if(inp==b) {
   curr_floor++;
   }
   else if(curr_floor!=0) {
   curr_floor--;
   }
   }
   else if(random_no==2) {
   int b = result*a;
   cin>>inp;
   if(inp==b) {
   curr_floor++;
   }
   else if(curr_floor!=0) {
   curr_floor--;
   }
   }
   else {
   int b = result/a;
   cin>>inp;
   if(inp==b) {
   curr_floor++;
   }
   else if(curr_floor!=0) {
   curr_floor--;
   }
   }
   }
   }
   cout<<"Play again?Y/N"<<endl;
   cin>>p;
}
   return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote