@ninman/

# solve_x.js

## No description

main.js
```1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
```
```// This JS program solves for X in basic algebra problems

// Greeting
alert("Welcome to Wyatt's first useful JS program!");
alert("This JS program solves for X in basic algebra problems!");
var step1or2 = prompt("Will you be calculating a 1 or 2 step algebra problem say 1 or 2:");

// Functions for 1 step problems are defined
function multiply() {
alert(enterx + " " + "=" + " " + mult_xval);
alert(mult_xval + " " + enter_op + " " + num1 + " " + "=" + " " + num2);
}

function divide() {
alert(enterx + " " + "=" + " " + div_xval);
alert(div_xval + " " + enter_op + " " + num1 + " " + "=" + " " + num2);
}

function subtract() {
alert(enterx + " " + "=" + " " + sub_xval);
alert(sub_xval + " " + enter_op + " " + num1 + " " + "=" + " " + num2);
}

alert(add_xval + " " + enter_op + " " + num1 + " " + "=" + " " + num2);
}

function step2() {
if (operator2 === '+' && operator1 === '/') {
num3 - num22;
num3 / num21;
} else if (operator2 === '-' && operator1 === '/') {
num3 + num22;
num3 / num21;
} else if (operator2 === '+' && operator1 === '*') {
num3 - num22;
num3 * num21;
} else if (operator2 === '*' && operator1 === '+') {
num3 + num22;
num3 / num21;
}
}
// Functions for 2 step algebra are defined

// All of the functions will be carried out here based on the user input
if (step1or2 === '1') {
var mult_xval = num2 / num1;
var div_xval = num1 * num2;
var sub_xval = num1 + num2;
var add_xval = num2 - num1;

// Variables are defined for 1 step

var enter_op = prompt("Enter the opperator that you will be using:");
var enterx = prompt("Enter a variable:");
var num1 = prompt("Enter a number:");
var num2 = prompt("Enter what the variable and the number equal:");

if (enter_op === '*') {
multiply();
} else if (enter_op === '/') {
divide();
} else if (enter_op === '-') {
subtract();
} else if (enter_op === '+') {
}
} else if (step1or2 === '2') {
var enterx2 = prompt("Enter a variable:");
var num21 = Number(prompt("Enter a number:"));
var operator1 = prompt("Enter the opperator that you will be using:");
var num22 = Number(prompt("Enter your second number:"));
var operator2 = Number(prompt("Enter the second operator that you will be using:"));
var num3 = Number(prompt("Enter what this equals:"));

}

// My longest JS program yet!

```
Native Browser JavaScript