Hello. I’m FAR from finished with my first app and am a total beginner to JavaScript, but I need some help because of these things. First off, some background on the app. It’s not a serious app, it’s meant for me to hone my skills. The premise for the app is that it randomizes blocks of time that you would enter on a hypothetical time card. You would add round numbers (example from 0700 - 0930 which is 2.5 hours)(btw uses 24 hr time). The purpose of this is to take your nice round time and randomly add or subtract a random 0-5 minutes on the end of it. It also tallies your cumulative time from your round numbers, and seperately tallies it for the simulated numbers. My problem is where it is tallying numbers. it doesnt always give the correct answer for the totals.

Here is my JS:

```
var startTimeEntry = document.querySelector(".startTime");
var endTimeEntry = document.querySelector(".endTime");
var hoursTotal = document.querySelector(".totalHours");
var simStart = document.querySelector(".simStart");
var simEnd = document.querySelector(".simEnd");
var simActual = document.querySelector(".simActual");
var oldStartTime = startTimeEntry.value;
var calc = document.querySelector("#calculate");
calc.addEventListener("click",newStartTime, true);
function newStartTime() {
var randomStart = Math.random();
if (randomStart < 0.5 && startTimeEntry.value.charAt(2) !== "3"&& startTimeEntry.value.charAt(2) !== "1" && startTimeEntry.value.charAt(2) !== "4" ) {
//&& startTimeEntry.value.charAt(2) !== "3"
var randomNum = (Math.random() * -5) -40 ;
}
else if (randomStart < 0.5 && startTimeEntry.value.charAt(2) == "3") {
var randomNum = (Math.random() * -5) ;
}
else if (randomStart < 0.5 && startTimeEntry.value.charAt(2) == "1") {
var randomNum = (Math.random() * -5) ;
}
else if (randomStart < 0.5 && startTimeEntry.value.charAt(2) == "4") {
var randomNum = (Math.random() * -5) ;
}
else randomNum = Math.random() * 5;
var roundNum = Math.floor(randomNum)
var numberx = parseInt(startTimeEntry.value);
simStart.value =(roundNum + numberx);
if (simStart.value < 1000) {
simStart.value = "0" + (roundNum + numberx);
}
}
calc.addEventListener("click",newEndTime, true);
function newEndTime() {
var randomStart = Math.random();
if (randomStart < 0.5 && endTimeEntry.value.charAt(2) !== "3" && endTimeEntry.value.charAt(2) !== "1" && endTimeEntry.value.charAt(2) !== "4" ) {
//&& startTimeEntry.value.charAt(2) !== "3"
var randomNum = (Math.random() * -5) -40 ;
}
else if (randomStart < 0.5 && endTimeEntry.value.charAt(2) == "3") {
var randomNum = (Math.random() * -5) ;
}
else if (randomStart < 0.5 && endTimeEntry.value.charAt(2) == "1") {
var randomNum = (Math.random() * -5) ;
}
else if (randomStart < 0.5 && endTimeEntry.value.charAt(2) == "4") {
var randomNum = (Math.random() * -5) ;
}
else randomNum = Math.random() * 5;
var roundNum = Math.floor(randomNum)
var numberx = parseInt(endTimeEntry.value);
simEnd.value =(roundNum + numberx);
if (simEnd.value < 1000) {
simEnd.value = "0" + (roundNum + numberx);
}
}
calc.addEventListener("click",totalHoursF,true);
function totalHoursF() {
var startingMinutes = (endTimeEntry.value - startTimeEntry.value);
var hundreds = startingMinutes / 100;
var noRemainder = Math.floor(hundreds);
var sixties = noRemainder * 60;
var remainingMinutes = startingMinutes % 100;
var totalMinutes = sixties + remainingMinutes;
hoursTotal.value = totalMinutes / 60;
}
calc.addEventListener("click",actualHoursF,false);
function actualHoursF() {
var startingMinutes = (simEnd.value - simStart.value);
var hundreds = startingMinutes / 100;
var noRemainder = Math.floor(hundreds);
var sixties = noRemainder * 60;
var remainingMinutes = startingMinutes % 100;
var totalMinutes = sixties + remainingMinutes;
simActual.value = totalMinutes / 60;
}
```

and here is the HTML:

```
<!DOCTYPE html>
<html lang = "en">
<head>
</head>
<body>
<h1>Number Generator <button id="calculate">Calculate</button></h1>
<table style = "width 100%">
<tr>
<th>Serial Number</th>
<th>Start Time</th>
<th>End Time</th>
<th>Total Hours</th>
<th>Sim Start</th>
<th>Sim End</th>
<th>Sim Actual</th>
</tr>
<tr>
<td><input type="text" class="workOrder" ></td>
<td><input type="text" class="startTime"></td>
<td><input type="text" class="endTime"></td>
<td><input type="text" class="totalHours"></td>
<td><input type="text" class="simStart"></td>
<td><input type="text" class="simEnd"></td>
<td><input type="text" class="simActual"></td>
</tr>
<tr>
<td><input type="text" class="workOrder" ></td>
<td><input type="text" class="startTime"></td>
<td><input type="text" class="endTime"></td>
<td><input type="text" class="totalHours"></td>
<td><input type="text" class="simStart"></td>
<td><input type="text" class="simEnd"></td>
<td><input type="text" class="simActual"></td>
</tr>
<tr>
```