Questions
Using the data set as a pre-defined variable in your program, write code that uses the...

Using the data set as a pre-defined variable in your program, write code that uses the dataset to print the first names of people who have BOTH above average math grades AND below average age from the dataset.

The solutions for the textbook examples assume you are able to export in a framework like node.js, which is why in the data set I provide, I simply set the array of objects as a variable. Your code will be in the same file (treat it like any other array variable). You can do the same with the sample files the chapter provides. For example:

var ancestry = [
    {
       .. object ..
    },
    ...
]

// your code here

Requirements:

  • Cannot use any array type built-in functions except filter(), map(), and reduce().

var dataSet = [
{
"name": "Maura Glass",
"age": 60,
"math": 97,
"english": 63,
"yearsOfEducation": 4
},
{
"name": "James Gates",
"age": 55,
"math": 72,
"english": 96,
"yearsOfEducation": 10
},
{
"name": "Mills Morris",
"age": 26,
"math": 83,
"english": 77,
"yearsOfEducation": 10
},
{
"name": "Deena Morton",
"age": 57,
"math": 63,
"english": 63,
"yearsOfEducation": 10
},
{
"name": "Edith Roth",
"age": 38,
"math": 79,
"english": 94,
"yearsOfEducation": 10
},
{
"name": "Marva Morse",
"age": 31,
"math": 93,
"english": 78,
"yearsOfEducation": 9
},
{
"name": "Etta Potts",
"age": 48,
"math": 57,
"english": 93,
"yearsOfEducation": 7
},
{
"name": "Tate Moss",
"age": 22,
"math": 83,
"english": 64,
"yearsOfEducation": 8
},
{
"name": "Sanders Burris",
"age": 27,
"math": 65,
"english": 66,
"yearsOfEducation": 5
},
{
"name": "Latoya Malone",
"age": 35,
"math": 100,
"english": 100,
"yearsOfEducation": 5
},
{
"name": "Wade Foreman",
"age": 25,
"math": 76,
"english": 87,
"yearsOfEducation": 10
},
{
"name": "Miller Valentine",
"age": 31,
"math": 56,
"english": 89,
"yearsOfEducation": 6
},
{
"name": "Rita Olson",
"age": 53,
"math": 100,
"english": 52,
"yearsOfEducation": 6
},
{
"name": "Potter Newton",
"age": 29,
"math": 91,
"english": 75,
"yearsOfEducation": 5
},
{
"name": "Madeline Bartlett",
"age": 23,
"math": 60,
"english": 74,
"yearsOfEducation": 10
},
{
"name": "Tamara Tran",
"age": 46,
"math": 73,
"english": 78,
"yearsOfEducation": 4
},
{
"name": "Elena Evans",
"age": 43,
"math": 60,
"english": 82,
"yearsOfEducation": 10
},
{
"name": "Cote Merrill",
"age": 55,
"math": 86,
"english": 63,
"yearsOfEducation": 7
},
{
"name": "Madeleine Brennan",
"age": 52,
"math": 82,
"english": 88,
"yearsOfEducation": 4
},
{
"name": "Alford Weber",
"age": 38,
"math": 71,
"english": 85,
"yearsOfEducation": 4
},
{
"name": "Kirsten Daniel",
"age": 35,
"math": 86,
"english": 61,
"yearsOfEducation": 8
},
{
"name": "Melton Chan",
"age": 26,
"math": 55,
"english": 96,
"yearsOfEducation": 4
},
{
"name": "Mcmahon Woodward",
"age": 54,
"math": 56,
"english": 63,
"yearsOfEducation": 9
},
{
"name": "Helga Monroe",
"age": 29,
"math": 79,
"english": 92,
"yearsOfEducation": 5
},
{
"name": "Patricia Herrera",
"age": 46,
"math": 94,
"english": 99,
"yearsOfEducation": 10
},
{
"name": "Mccullough Lambert",
"age": 56,
"math": 65,
"english": 96,
"yearsOfEducation": 8
},
{
"name": "Haynes Davidson",
"age": 60,
"math": 86,
"english": 50,
"yearsOfEducation": 5
}
]

In: Computer Science

Add logic to tell me to switch to unlimited if I go over $75. Use C++...

Add logic to tell me to switch to unlimited if I go over $75. Use C++

/*******************************************************************************
** Program Name: Verizons Monthly Bill Calculator.
** File Name: file a03.cpp.
** Author: Natassha Quiroz
** Date: October 18, 2020 (updated 10/20/20)
** Assignment: 03
** Description: The purpose of this program is to calculate the consumers monthly cell
** phone bill based on data usage.
** Sources: Lecture slides, lecture videos and practice programs from lecture video.
*******************************************************************************/
#include <iostream>
#include <cmath>

using namespace std;

int main()
{
// declaring constants.
const int PLANS = 35;
const int PLANM = 50;
const int PLANL = 70;
const int PLANU = 75;

// declaring variables.
char planchoice;
double total = 0.0, data = 0.0;

//This while will continue to prompt the question until the user enters a valid response.
while (true)
{
// displaying the menu
cout << "S = Plan A" << endl;
cout << "M = Plan B" << endl;
cout << "L = Plan C" << endl;
cout << "U = Plan unlimited" << endl;

// getting the plan plan choice entered by the user
cout << "Which one of these plans do you have? ";
cin >> planchoice;

// Checking whether the user entered a valid plan choice
if (planchoice != 'S' && planchoice != 's' && planchoice != 'M'
&& planchoice != 'm' && planchoice != 'L'
&& planchoice != 'l' && planchoice != 'U' && planchoice != 'u')
{
cout << "** Invalid Plan Choice **" << endl;
}
else
break;
}

// getting the choice entered by the user
cout << "How many GB have you used so far? ";
cin >> data;

data = ceil(data);

// Based on the user plan choice the corresponding case will be executed
switch (planchoice)
{
case 'S':
case 's':
{
if (data <= 2)
{
total = PLANS;
}
else
{
total = PLANS;
for (int i = 1; i <= data - 2; i++)
{
total += 15;
}
}
break;
}
case 'M':
case 'm':
{
if (data <= 2)
{
total = PLANM;
}
else
{
total = PLANM;
for (int i = 1; i <= data - 2; i++)
{
total += 15;
}
}

break;
}
case 'L':
case 'l':
{
if (data <= 2)
{
total = PLANL;
}
else
{
total = PLANL;
for (int i = 1; i <= data - 2; i++)
{
total += 15;
}
}

break;
}
case 'U':
case 'u':
{
total = PLANU;
break;
}
}

// display the customers total charge
cout << "Total Charges :$" << total << endl;

return 0;
}

In: Computer Science

Locate your Student project from the previous in-class assignment. You will add a new class to...

Locate your Student project from the previous in-class assignment. You will add a new class to that project.

1. Create a class called Course. It should have a field to hold an ArrayList of Student objects.

2. Create a constructor for Course that accepts an ArrayList of Student objects, and set field to the parameter.

3. In the Course class, create a method called addStudent(Student s). This should add the parameter "s" to the ArrayList of Student objects.

4. In the Course class, create a method called removeStudent(Student s). This method should remove the parameter"s" from the ArrayList of Student objects.

5. In the Course class, create a method called toString(). This method should return a String showing the information from all the Student objects in the ArrayList. It should be formatted in the following way:

"Student 0: *Student 0 toString()*

Student 1: *Student 1 toString()*

...

Student n: *Student n toString()*"

This method should call each Student object's toString() method, as shown in the above example.

MY CODE :

student.java

package student;


public class Student {

  
public static void main(String[] args) {
  
  
Course myNewCourse = new Course(2) ;

System.out.println(myNewCourse.toString());
}
  
private int idNum;
private String firstN;
private String lastN;
  
public Student(int studentId, String firstName, String lastName ){   
idNum = studentId;
firstN = firstName;
lastN = lastName;
}
  
public String toString(){   
  
String allData = "Student"+"1"+":ID: "+getIdNum()+ ", First name: "
+ getFirstName()+ ", Last name: " +getLastName()+ "." ;
  

return allData;
}
  
public void setIdNum(int studentId){
  
this.idNum = studentId;
  
  
  
}
  
public void setFirstName(String firstName){
  
this.firstN = firstName;
  
  
}
  
public void setLastName(String lastName){
  
this.lastN = lastName;
  
}
  
public int getIdNum(){
  
  
return idNum;
  
}
  
  
public String getFirstName(){
  
return firstN;
  
}
  
public String getLastName() {
  
return lastN;
}
}

course.java

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package student;

import java.util.ArrayList;

/**
*
* @author farha
*/
public class Course {
  
ArrayList<Student> students = new ArrayList<Student>();
  
  
  
public Course(ArrayList<Student> students){
  
this.students = students;
  
  
}
  
public void addStudent(Student s){
  
students.add(0, s);
  
  
  
}
  
public void removeStudent(Student s){
  
students.remove(s);
  
}
  
public String toString(){
  
String information = ("");
  

return information;
}
  
  
  
}

In: Computer Science

Please fllll this out thank you /** * * Creates a six-sided die and rolls it...

Please fllll this out thank you

/**
*


* Creates a six-sided die and rolls it 20 times. It outputs the face values and also
* the number of times the die lands on 6.
*
* Creates 2 eight-sided dice and rolls the pair 10 times. It prints out a sequence
* of pairs representing the face values as well as the number of doubles.
*
* Allows the user to repeat the above steps as often as (s)he wishes.
*
* @author (put your name here!!!)
* @version (3-20-19)
*/
import java.util.*;
public class TestDie
{
public static void main (String [] args)
{
Scanner keyIn = new Scanner(System.in);

// display output heading
System.out.println ("Programmer: put your name here!!");
System.out.println ("Course: COSC 111, Winter '19");
System.out.println ("Lab: Exam 2, part 2");
System.out.println ("Due date: 3-20-19\n");


// create a six-sided die
// create a Die object and then call the method setSides to set the number of sides to 6


// roll the die 20 times, output the face value of each roll (4 per line), and the
// number of times the die lands on 6.
// set up a loop that iterates exactly 20 times, and each time through the loop do the following:
// roll the die by calling the method 'roll'; output the face value of the die; check the face
// value to keep track of 6s, and check to see if you have printed 4 numbers already, if yes,
// then advance to the next line.

System.out.println("Rolling a 6-sided die 20 times:" );

// create two eight-sided dice
// create two 'Die' objects and then use the method 'setSides' with each object to set its number of sides to 8

System.out.println("\nRolling a pair of 8-sided dice 10 times:");

// throw a pair of eight-sided dice 10 times, output the face values of each throw as a pair
// and also the number of doubles (both dice land on the same face value)
// set up a loop that iterates exactly 10 times, and each time through the loop do the following:
// roll both die by calling the method 'roll' twice; print out their face values as a pair;
// and check to see if both face values are the same, if yes, keep track of it.

// add a do-while loop to repeat the above code as often as the user wishes

}

}

In: Computer Science

Deborah purchases a new $32,000 car in 2016 to use exclusively in her business. If Deborah...

Deborah purchases a new $32,000 car in 2016 to use exclusively in her business. If Deborah does not elect to expense but does take bonus depreciation in 2016 and holds the car until it is fully depreciated, how many years will this take? Please show your calculation:

In: Accounting

what is the density of a 50% (m/v) solution of glycerol

what is the density of a 50% (m/v) solution of glycerol

In: Chemistry

how do we perform fato V assay?

how do we perform fato V assay?

In: Biology

Brief case of New Prime Inc. v. Oliveira,

Brief case of New Prime Inc. v. Oliveira,

In: Accounting

proof of eulers theory:- V+F-E=2

proof of eulers theory:- V+F-E=2

In: Advanced Math

brief IRAC of case 40.1 Oliveira v. Sugarman

brief IRAC of case 40.1 Oliveira v. Sugarman

In: Finance