Stopping/pausing audio when button is clicked

I want to be able to play and pause an mp3 file on the click of a single button, what I currently have plays the audio, but if I click it again it does not stop it.

By what I’ve seen on another posts the method that does it is audio.pause(), but it has no effect in my code.

Code:

function playStop(){
                document.getElementById('playControl').style.visibility='visible';
                var audio = new Audio('mp3/audio.mp3');
                
                if (document.getElementById('playbtn').innerHTML=="❚❚"){
                    audio.pause();
                    audio.currentTime = 0;
                    document.getElementById('playbtn').innerHTML="▷";
                }
                else if(document.getElementById('playbtn').innerHTML=="▷"){
                    audio.play();                
                    document.getElementById('playbtn').innerHTML="❚❚";
                }
            }  

Note: The lines that change the html content do work, only the audio.pause() method doesn’t.

tyia

if checks inside a reduce() sum function

I am trying to iterate through an array in typescript, but on occasion, inside the array there will be an empty value or NaN (null) value by default. this really mucks up my sum function, as it is trying to call parseInt() on a null value, so the function also returns NaN. How can I make an if condition inside of this function to check for Number() first otherwise skip/continue ?
I know I can naively have a for each loop, and check for this inside of an if statement, but that is not ideal.

    sumOwnershipLiabilityPercentages(): number{
        // return the sum of all the percentage ownerships
        return this.liabilitiesOwnershipList.reduce((prev: number, cur: any) => prev + parseInt(cur.percentage), 0);
    }

Can’t set audio.currentTime with input from range slider

I am trying to create a custom interaface for the audio tag but am having trouble setting the the audio.currentTime value. When I try to set the audio position by dragging the slider, it snaps back to 0 and when checking audio.currentTime in the developer console, it still returns 0. Here is what I have so far:

const audio = $("#audio")[0];
const progress = $("#progress");
const time = $("#time");
const duration = $("#duration");

let tmpTime = 0;

audio.onloadedmetadata = (e) => {
    progress.attr("max", e.target.duration);
    progress.val(0);

    const date = new Date(e.target.duration * 1000)
        .toISOString()
        .slice(11, 19);

    duration.text(date);
};

audio.ontimeupdate = (e) => {
    progress.val(e.target.currentTime);
    const date = new Date(audio.currentTime * 1000)
        .toISOString()
        .slice(11, 19);

    time.text(date);
};

progress.on("input", (e) => {
    tmpTime = e.target.value;
    const date = new Date(tmpTime * 1000)
        .toISOString()
        .slice(11, 19);

    time.text(date);
});

progress.on("change", (e) => {
    audio.currentTime = parseInt(e.target.value);
});

How to apply different free trials for different subscriptions in the same order – Stripe

Let’s say I have 2 items in the order, and both items are subscriptions. I want to give free trial for both subscriptions, but the period of free trial should be different for each subscription.

After checking the docs, I was able to set free trial to the whole order by specifying subscription_data.trial_period_days property on the order itself. But that will apply the same free trial to all subscriptions. I want to give a different free trial period to each subscription.

How can .val return a localtime value?

In the val docs written this description:

.val() Returns: String, Number, Array

I tried to get a Time, but it seems to return string only, Is there any method to parse the val value to localtime?

$.get(href,function(exam,status){
            $('#startTimeEdit').val(exam.startTime);
            $('#endTimeEdit').val(exam.endTime);
        });

Overall, my question will be how to parse the val value to LocalTime datatype?

Is it possible to set a cookie on another domain using javascript?

I’m trying to set a same cookie on a website A and a website B.
I’m using xhr to send a request from the website A to the website B.

Here’s the code that I use:

JS code from the website A:

var xhr = new XMLHttpRequest();
            xhr.open('GET', 'https://websiteb.com/?sessid=<?php echo session_id(); ?>', true);
            xhr.withCredentials = true;
            xhr.send(null);

PHP code from the website B:

header("Access-Control-Allow-Credentials: true");
header("Access-Control-Allow-Headers: Set-Cookie");
header("Access-Control-Allow-Origin: https://websiteA.tld");
header('Content-Type: application/json');
setcookie('PHPSESSID', $_GET['sessid'], array(
        'expires' => time() + $cookielifetime,
        'path' => '/',
        'secure' => true,
        'httponly' => false,
        'SameSite' => 'None'
));

From my home computer (using Google Chrome Canary) it works.
But from my laptop (and my friend’s laptop), the cookie’s not set.

I tried to send a postman post request to see if the cookie would be set, but I only get the website A’s cookie.

Postman POST Request

Is there somebody here that can help me (or can tell me how I can set a cookie on a different domain)?

How can I detect https redirects using only built in node modules?

I don’t want to actually follow the re-direct as seen here, I simply want to detect a redirect.

Here is my current code. Please note I want to simply detect a redirect and not do anything with it. The code works fine but downloads gibberish on a redirect.

I don’t want to use any external modules. I believe there is a thing called headers that might come in use.

const https = require('https');
const fs = require('fs');

function download(entry, destination, callback) {
  const writeStream = fs.createWriteStream(destination);
  const request = https.get(entry, (response) => {
    response.pipe(writeStream);
  }).on('error', (error) => {
    console.log('DEBUG:', error);
  });
}

A good example of a redirect is here:

https://www.imdb.com/favicon.ico

Javascript: Copy specified Col through last col and paste down to last row

I’m extremely green to javascript and have pieced together what I need through searching online and watching videos. I need to set multiple columns in row4, starting from col 18 through to lastcolumn, as the active cells to copy and then pasteformulas down to the last row (if necessary, based on col 4’s data). Code I have below activates (selects) all data from col 18 through last column (as intended) but also through last row (unintended). Anyone know how to correct this?

    function CopyFormulasDown() {
  var ss = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
  var sRA4 = ss.getRange(4,1); //First copy is A4 ..this one works as intended
  var lr = ss.getLastRow();
  var lc = ss.getLastColumn();
  var sRR4lc = ss.getRange('R4:'+ lc +'4'); //Trying to select R4 through last col within row4; also tried (4,18+':'+lc), but throws an error: Exception: Cannot convert '18:37' to int.
  var fillDownRangeA4 = ss.getRange(4,1,lr);
  var fillDownRangeR4lc = ss.getRange(4,18,lr,lc);
  
   // sRA4.activate(); //range cell A4 is copied
    //sRA4.copyTo(fillDownRangeA4);  //copied cell pastes formula down to last row ..WORKS!
    sRR4lc.activate(); //ROW4 COL18 is selected through to last col as intended, but also selects down to last row.... problem is I didn't tell it to select past row 4... not sure how to correct this
   // sRR4lc.copyTo(fillDownRangeR4lc); //commented out for now until I can get just row 4 from col 18 through last col copy to work
};

HTML Templating in Firebase

I am creating a simple blog on Firebase. I cannot find any documentation or examples on best practices on how to create HTML templates for all of my posts. Here’s what I’m thinking

  • For each new post I just create a new HTML page and copy and paste my old HTML as a template

I dont think that this is the correct way in doing this. I guess my question just really boils down to this

How do I manage creating new ‘posts’ in a static HTML website?

In MapBox GL JS, how do I prevent pop-up labels from constantly showing up when I don’t want to see them?

I have made an application with MapBox GL JS. I have tons of markers all over the world. When the mouse cursor hovers over them, I have them pop up a box with a description. This is normally what I want, but when zooming in/out and moving around the map, I frequently see these labels flickering as they are displayed and hidden while the mouse cursor moves around. This is very annoying.

I’m trying to find a good and simple way to prevent this, perhaps by requiring some amount of milliseconds of hovering over the marker before this happens. Or perhaps by using some sort of built-in “is the mouse cursor still or moving around” flag. I do not want to require me to actually click the labels, because that would soon become even more annoying.

I currently use this code:

map.on('mouseenter', layerId, (e) =>
{
    map.getCanvas().style.cursor = 'pointer';
    const coordinates = e.features[0].geometry.coordinates.slice();
    const description = e.features[0].properties.description;
    const name = e.features[0].properties.name;
    while (Math.abs(e.lngLat.lng - coordinates[0]) > 180) { coordinates[0] += e.lngLat.lng > coordinates[0] ? 360 : -360; }
    popup.setLngLat(coordinates).setHTML(name).addTo(map);
});

map.on('mouseleave', layerId, () =>
{
    map.getCanvas().style.cursor = '';
    popup.remove();
});

This must be a common problem. Do you know about, or can you think of, some way to solve this which isn’t annoying? If I have to hover the cursor standing still above the label to show it, I might as well require a click. But that’s already disqualified. Plus I already use the click event for a different thing (“open related URL”).

Three.js – moving the object with animation

I was playing around with three.js using models and animations from Mixamo.
One of the animations is called Big Jump
and the model moves forward in it and when the animation ends, it comes back to its starting location. Is it possible to stop the model from coming back to starting position after animation?
Or in general, is it posibble to manipulate the position of model using such animations?

TypeError when trying to count checkboxes

I’m painfully close here – I’m getting a TypeError when the form is submitted and no checkboxes are selected in the HTML file – the error occurs when pizzaOptions.length is being read (line 37 of the js file) because I’m assuming it’s trying to read something that’s undefined?

How do I work around this. Here is my TypeError: enter image description here

var express = require('express');
var bodyParse = require('body-parser');
var app = express();

app.use(express.static('public_html'));
app.use(bodyParse.urlencoded({
  extended: false
}));


function addMinutes(date, minutes) {
  return new Date(date.getTime() + minutes * 60000);
}

app.post('/order', function(req, res) {
  var days, months;
  days = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
  months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
  let firstname = req.body.firstname;
  let surname = req.body.surname;
  let timeNow = new Date();
  let address = req.body.address;
  let city = req.body.city;
  let postCode = req.body.postcode;
  let state = req.body.state;
  let email = req.body.email;
  let phoneNumber = req.body.mobile;
  let pizzaType = req.body.pizzaType;
  let numberOfPizzas = req.body.numBoxes;
  let pizzaSize = req.body.pizzaSize;
  let pizzaOptions = req.body.pizzaOptions;
  let orderDate = new Date();
  let promoCode = req.body.promoCode;
  let deliveryTime = addMinutes(orderDate, 45).toLocaleTimeString();

  if (typeof pizzaOptions === "undefined") {
    pizzaOptions
  }
  let totalPizzaOptions = 0.5 * pizzaOptions.length;

  if (totalPizzaOptions > 2) {
    totalPizzaOptions = 0.5;
  }

  // PIZZA COSTS
  let cheese = 12.55;
  let veggie = 12.75;
  let marinara = 15.55;
  let supreme = 16.25;
  let tropical = 11.75;
  let veggiesupreme = 13.75;
  //SIZE COSTS
  let Medium = 1.50;
  let Large = 2;
  let XLarge = 3.50;

  //TOTALS AND DELIVERY
  let totalCost = 0;
  let finalAmount = 0;
  let discount = 0;
  let discountAmount = 0;
  let deliveryCost = 5;

  switch (pizzaType) {
    case 'Cheese Pizza':
      totalCost = totalCost + cheese;
      break;
    case 'Veggie Pizza':
      totalCost = totalCost + veggie;
      break;
    case 'Marinara Pizza':
      totalCost = totalCost + marinara;
      break;
    case 'Super Supreme':
      totalCost = totalCost + supreme;
      break;
    case 'Tropical Pizza':
      totalCost = totalCost + tropical;
      break;
    case 'Veggie Supreme':
      totalCost = totalCost + veggiesupreme;
  }

  switch (pizzaSize) {
    case 'Small':
      totalCost = totalCost + 0;
      break;
    case 'Medium':
      totalCost = totalCost + Medium;
      break;
    case 'Large':
      totalCost = totalCost + Large;
      break;
    case 'Extra Large':
      totalCost = totalCost + XLarge;
  }

  switch (promoCode) {
    case "7342418":
      discount = "Dinner-4-All (10%)";
      discountAmount = 0.1;
      break;
    case "8403979":
      discount = "Winter-Special (25%)";
      discountAmount = 0.25;
      break;
    case "2504647":
      discount = "Midweek-Deal (50%)";
      discountAmount = 0.5;
      break;
    case "8406800":
      discount = "Special Gift (75%)";
      discountAmount = 0.75;
      break;
    default:
      discount = "No discount applied";
      discountAmount = 0;
  }


  totalCost = totalCost * numberOfPizzas;
  discountAmount = (totalCost * discountAmount);
  finalAmount = (totalCost - discountAmount) + deliveryCost + totalPizzaOptions;
  finalAmount = finalAmount.toFixed(2);


  res.write('<html><head>');
  res.write("<link rel='stylesheet' href='https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css' integrity='sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk' crossorigin='anonymous'></head>");
  res.write('<body> <div class="container">');
  res.write("<h1 class='text-left'>ORDER CONFIRMATION</h1>");
  res.write(`<p>Thank you for your order received on: <strong>${timeNow}</strong></p>`);

  res.write("<h2 class='text-left'>Pizza Details</h2>");
  res.write(`<p>${numberOfPizzas} x ${pizzaSize} ${pizzaType} [Options: ${pizzaOptions}]</p>`);


  res.write("<h2 class='text-left'>Customer Details</h2>");
  res.write(`<p>Customer: ${firstname} ${surname}</p>`);
  res.write(`<p>Address: ${address}, ${city}, ${state}, ${postCode}</p>`);
  res.write(`<p>Contact mobile: ${phoneNumber}</p>`);
  res.write(`<p>Contact email: ${email}</p>`);


  res.write("<h2 class='text-left'>Pizza Cost</h2>");

  res.write('<div class="container">');
  res.write('<div class="row">');
  res.write('<div class="col">');
  res.write(`<p>${numberOfPizzas} x ${pizzaSize} ${pizzaType} [Options: ${pizzaOptions}]</p>`);
  res.write('</div>');
  res.write('<div class="col">');
  res.write(`$ ${totalCost}`);
  res.write('</div>');
  res.write('</div>');

  res.write('<div class="row">');
  res.write('<div class="col">');
  res.write(`Optional Extras @ $0.50 each`);
  res.write('</div>');
  res.write('<div class="col">');
  res.write(`$ ${totalPizzaOptions}`);
  res.write('</div>');
  res.write('</div>');

  res.write('<div class="row">');
  res.write('<div class="col">');
  res.write('Delivery');
  res.write('</div>');
  res.write('<div class="col">');
  res.write(`$ ${deliveryCost}.00`);
  res.write('</div>');
  res.write('</div>');

  res.write('<div class="row">');
  res.write('<div class="col">');
  res.write(`Discount - ${discount}`);
  res.write('</div>');
  res.write('<div class="col">');
  res.write(`$ - ${discountAmount}`);
  res.write('</div>');
  res.write('</div>');

  res.write('<div class="row">');
  res.write('<div class="col">');
  res.write('<strong>Total');
  res.write('</div>');
  res.write('<div class="col">');
  res.write(`$ ${finalAmount}</strong>`);
  res.write('</div>');
  res.write('</div>');
  res.write('</div>');

  res.write("<h2 class='text-left'>Estimated Delivery Time</h2>");
  res.write(`<p>Delivery Expected by: <strong>${deliveryTime}</strong> -- or the pizza is free!</p>`);

  src = "https://code.jquery.com/jquery-3.5.1.slim.min.js"
  integrity = "sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj"
  crossorigin = "anonymous"
  src = "https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js"
  integrity = "sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo"
  crossorigin = "anonymous"
  src = "https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js"
  integrity = "sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI"
  crossorigin = "anonymous"
  res.write('</body></html>');
  res.send();
});

app.listen(3000, function() {
  console.log("Web server running at: http://localhost:3000");
  console.log("Type Ctrl+C to shut down the web server");
});
<!doctype html>
<html lang="en">

<head>
  <title>Task 9.3C</title>

  <meta charset="utf-8">
  <meta name="author" content="SIT774">
  <meta name="description" content="Express Sqlite3 Demo">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

  <!-- Latest compiled and minified CSS -->
  <!-- CSS only -->
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-B0vP5xmATw1+K9KRQjQERJvTumQW0nPEzvF6L/Z6nronJ3oUOFUFpCjEUQouq2+l" crossorigin="anonymous">
</head>
<script>
  function myFunction() {
    var pizzaOptions = document.forms[0];
    var txt = 0;
    var i;
    for (i = 0; i < pizzaOptions.length; i++) {
      if (pizzaOptions[i].checked) {
        txt = txt + pizzaOptions[i].value + " ";
      }
    }
  }
</script>

<body>
  <div class="container">

    <h1>dKin Pizza Order Form</h1>
    <p>Thank you for choosing dKin Pizza! Please fill in the customer &amp; pizza order details below.</p>

    <form action="/order" method="post" name="form" id="form">
      <h5 class="bg-primary text-white rounded-sm p-1">Customer Details</h5>
      <div class="form-row">
        <div class="col-sm-6 mb-1">
          <label for="firstname"><small>First name</small></label>
          <input type="text" class="form-control" name="firstname" id="firstname" placeholder="Mark" required>
        </div>
        <div class="col-sm-6 mb-1">
          <label for="surname"><small>Last name</small></label>
          <input type="text" class="form-control" name="surname" id="surname" placeholder="Smith" required>
        </div>
      </div>
      <div class="form-row">
        <div class="col mb-1">
          <label for="address"><small>Delivery
                            Address</small></label>
          <input type="text" class="form-control" name="address" id="address" placeholder="123 Apple St" required>
        </div>
      </div>

      <div class="form-row">
        <div class="col-sm-6 mb-1">
          <label for="city"><small>City</small></label>
          <input type="text" class="form-control" name="city" id="city" placeholder="Geelong" required>
        </div>
        <div class="col-sm-3 mb-1">
          <label for="state"><small>State</small></label>
          <select class="custom-select " name="state" id="state" required>
            <option selected disabled value="">Choose...</option>
            <option>VIC</option>
            <option>NSW</option>
            <option>ACT</option>
            <option>QLD</option>
            <option>SA</option>
            <option>TAS</option>
            <option>SA</option>
          </select>
        </div>
        <div class="col-sm-3 mb-1">
          <label for="postcode"><small>Postcode</small></label>
          <input type="text" class="form-control" name="postcode" id="postcode" placeholder="3216" required>
        </div>
      </div>
      <div class="form-row">
        <div class="col-sm-6 mb-4">
          <label for="email"><small>Email
                            address</small></label>
          <input type="text" class="form-control" name="email" id="email" placeholder="[email protected]" required>
        </div>
        <div class="col-sm-6 mb-4">
          <label for="mobile"><small>Mobile number
                        </small></label>
          <input type="text" class="form-control" name="mobile" id="mobile" placeholder="04xx xxxx" required>
        </div>
      </div>

      <h5 class="bg-primary text-white rounded-sm p-1 mb-3">Pizza Selection
      </h5>

      <div class="form-group row">
        <label class="col-sm-2 col-form-label text-sm-right" for="pizzaType">Select
                    your pizza:</label>
        <div class="col-sm-6 my-auto">
          <select class="form-control" name="pizzaType" id="pizzaType" required>
            <option selected disabled value="">Please select a pizza type....
            </option>
            <option value="Cheese Pizza">Cheese Pizza</option>
            <option value="Veggie Pizza">Veggie Pizza</option>
            <option value="Marinara Pizza">Marinara Pizza</option>
            <option value="Super Supreme">Super Supreme</option>
            <option value="Tropical Pizza">Tropical Pizza</option>
            <option value="Veggie Supreme">Veggie Supreme</option>
          </select>
        </div>
        <label class="col-form-label col-sm-2 text-sm-right" for="numberOfPizzas">Number of pizzas:</label>
        <div class="col-sm-2 my-auto">
          <input type="number" class="form-control" id="numberOfPizzas" value="1" name="numBoxes" min="1" max="99" required>
        </div>
      </div>
      <div class="form-group row">
        <label class="col-form-label col-sm-2 text-sm-right" for="pizzaSizeSelection">Select a size:</label>
        <div class="col-sm-10 my-auto">
          <div class="form-check form-check-inline" id="pizzaSizeSelection">
            <div class="form-check form-check-inline">
              <input class="form-check-input" type="radio" name="pizzaSize" id="inlineRadio1" value="Extra-Large">
              <label class="form-check-label" for="inlineRadio1">Extra-Large</label>
            </div>
            <div class="form-check form-check-inline">
              <input class="form-check-input" type="radio" name="pizzaSize" id="inlineRadio2" value="Large" checked>
              <label class="form-check-label" for="inlineRadio2">Large</label>
            </div>
            <div class="form-check form-check-inline">
              <input class="form-check-input" type="radio" name="pizzaSize" id="inlineRadio3" value="Medium">
              <label class="form-check-label" for="inlineRadio3">Medium</label>
            </div>
            <div class="form-check form-check-inline">
              <input class="form-check-input" type="radio" name="pizzaSize" id="inlineRadio3" value="Small">
              <label class="form-check-label" for="inlineRadio3">Small</label>
            </div>

          </div>
        </div>
      </div>

      <div class="form-group row">
        <label class="col-form-label col-sm-2 text-sm-right" for="pizzaOptions">Special requests:</label>
        <div class="col-sm-10 my-auto">

          <div class="form-check form-check-inline">
            <input class="form-check-input" type="checkbox" name="pizzaOptions" value="Extra Cheese">
            <label class="form-check-label" for="pizzaOptions">
                            Extra Cheese</label>
          </div>

          <div class="form-check form-check-inline">
            <input class="form-check-input" type="checkbox" name="pizzaOptions" value="Roasted Garlic">
            <label class="form-check-label" for="pizzaOptions">
                            Roasted Garlic</label>
          </div>

          <div class="form-check form-check-inline">
            <input class="form-check-input" type="checkbox" name="pizzaOptions" value="Thick Crust">
            <label class="form-check-label" for="pizzaOptions">
                            Thick Crust</label>
          </div>

          <div class="form-check form-check-inline">
            <input class="form-check-input" type="checkbox" name="pizzaOptions" value="No Chilli">
            <label class="form-check-label" for="pizzaOptions">
                            No Chilli</label>
          </div>

          <div class="form-check form-check-inline">
            <label class="form-check-label" for="promoCode">
                            Promotional Code:</label>
            <input class="form-check-input" type="number" name="promoCode" id="promoCode" placeholder="XXXX">
          </div>
        </div>


        <div class="form-group row ">
          <div class="col-sm mx-auto d-flex justify-content-center ">
            <button type="submit" class="btn btn-primary" onclick="myFunction()">Submit</button>
          </div>

        </div>
    </form>
    </div>

    <!-- jQuery library -->
    <script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-Piv4xVNRyMGpqkS2by6br4gNJ7DXjqk09RmUpJ8jgGtD7zP9yug3goQfGII0yAns" crossorigin="anonymous"></script>
    <script type="text/javascript" src="9.3.js"></script>
</body>

</html>

My java code isn’t compiling? Please help me

I’ve tried everything it says there’s an issue with the word student and that it cannot find the symbol but I don’t know what to do.

/*
Programmer: Jordan McIntosh
Date: 02/11/2022
School: Science Hill High School
Purpose: the purpose is to import 4 students and be given their total points,
grade, and average
*/
class Main{

      public static void main(String[] args){
        //creating new student named Jordan
    Student Jordan = new Student();
        Jordan.setName("Jordan");
        Jordan.setCourse("AP CSA");
        Jordan.setGrade(11);
        Jordan.addScore(95);
        Jordan.addScore(80);

        //creating new student named Nick
        Student Nick = new Student();
        Nick.setName("Nick");
        Nick.setCourse("Biology");
        Nick.setGrade(11);
        Nick.addScore(78);
        Nick.addScore(95);
        Nick.addScore(97);
        Nick.addScore(56);

        //creating new student named Luke
        Student Luke = new Student();
        Luke.setName("Luke");
        Luke.setCourse("AP Psychology");
        Luke.setGrade(11);
        Luke.addScore(51);
        Luke.addScore(94);
        Luke.addScore(89);
        Luke.addScore(100);
   
        //creating new student named Drew
        Student Drew = new Student();
        Drew.setName("Drew");
        Drew.setCourse("Credit Recovery");
        Drew.setGrade(11);
        Drew.setScore(12);
        Drew.setScore(47);
        Drew.setScore(91);
        Drew.setScore(62);
        Drew.setScore(92);
        Drew.setScore(78);
  

        //formulating the average of each student
        double avg = Jordan.getPoints() / Jordan.NumScores() ;
        double avg1 = Nick.getPoints() / Nick.NumScores() ; 
        double avg2 = Luke.getPoints() / Luke.NumScores() ; 
        double avg3 = Drew.getPoints() / Drew.NumScores() ; 

        //printing Jordan's information
        System.out.println("Student Name: "+ Jordan.getName());
        System.out.println("Student Course: "+ Jordan.getCourse());
        System.out.println("Student Grade: "+ Jordan.getGrade());
        System.out.println("Number of Scores: " +Jordan.getNumScores());
        System.out.println("Total Points: " +Jordan.getPoints());
        System.out.println("Average: "+ avg +"n" );

        //printing Nick's information
        System.out.println("Student Name: "+ Nick.getName());
        System.out.println("Student Course: "+ Nick.getCourse());
        System.out.println("Student Grade: "+ Nick.getGrade());
        System.out.println("Number of Scores: " +Nick.getNumScores());
        System.out.println("Total Points: " +Nick.getPoints());
        System.out.println("Average: "+ avg +"n" );

        //printing Luke's information
        System.out.println("Student Name: "+ Luke.getName());
        System.out.println("Student Course: "+ Luke.getCourse());
        System.out.println("Student Grade: "+ Luke.getGrade());
        System.out.println("Number of Scores: " +Luke.getNumScores());
        System.out.println("Total Points: " +Luke.getPoints());
        System.out.println("Average: "+ avg +"n" );
 
        //printing Drew's information
        System.out.println("Student Name: "+ Drew.getName());
        System.out.println("Student Course: "+ Drew.getCourse());
        System.out.println("Student Grade: "+ Drew.getGrade());
        System.out.println("Number of Scores: " +Drew.getNumScores());
        System.out.println("Total Points: " +Drew.getPoints());
        System.out.println("Average: "+ avg +"n" );




      }
    }