HW01
.docx
keyboard_arrow_up
School
New Jersey Institute Of Technology *
*We aren’t endorsed by this school
Course
434
Subject
Computer Science
Date
May 4, 2024
Type
docx
Pages
10
Uploaded by JusticeUniverse25366 on coursehero.com
All PL/SQL work needs to be done with SQL Developer. All database work needs to be done in Oracle.
1)
a)
Write a PL/SQL function called CONSTANT_E that takes an argument N and sends to
the screen the number e using the following formula:
CS 434 Spring 2024
HOMEWORK 1
General Instructions. Read this carefully.
This is more important than the individual questions.
There are NO GROUP HOMEWORKS IN THIS CLASS. YOU NEED TO WORK ALONE.
1) Do not copy code from any other person. You can ask questions and get answers, but NEVER copy code. Also, do not copy and paste English text unless I specifically permit it. NEVER.
2) SHOW EVERYTHING. Anything you don't show will be automatically assumed as not done.
Don't logically argue that "of course, you must have done it." If we don't see it, then it is not done.
3) There will be no half points. Questions worth 1 point will be graded "all or nothing."
Points will appear in [ ] brackets.
The whole homework is worth 50 points.
If you miss the due date by up to one week, there will be a late penalty of 8 points subtracted.
If you miss the due date by MORE than a week you will get ZERO points.
The due date is Monday, February 19, 2024, 4:00 PM.
Your file name must have the format: LASTNAME_firstname_HWK1.doc (or .docx)
Example: CONSTANT_E(5) should send to the screen:
N = 5, e = 2,716667
Copy/paste your PL/SQL code (both functions and main program) at the first red arrow
► CREATE OR REPLACE FUNCTION CONSTANT_E(N IN NUMBER) RETURN NUMBER
IS
e_Val number := 1;
factorial number := 1;
BEGIN
for i IN 1..N
loop
e_Val := e_Val + (1 / factorial);
end loop;
DBMS_OUTPUT.PUT_LINE('N = ' || N || ',' || 'e = ' || e_Val);
RETURN e_Val;
END CONSTANT_E;
/
DECLARE
N number;
BEGIN
N := CONSTANT_E(5);
END;
/
1)
b)
Write a PL/SQL function called E_to_X that takes an arguments N and X and sends to
the screen the number e
x
using the following formula:
Example: E_to_X (5,3) should send to the screen:
X=3, N=5
Copy/paste your PL/SQL code (both functions and main program) at the first red arrow
► CREATE OR REPLACE FUNCTION E_to_X(N IN NUMBER, X IN NUMBER) RETURN NUMBER IS
e_to_x number := 1;
factorial number := 1;
BEGIN
for i in 1..N loop
power_x := power_x * X;
e_to_x := e_to_x + (power_x / factorial);
end loop;
DBMS_OUTPUT.PUT_LINE('X = ' || X || ',' || 'N = ' || N || ',' || 'e_to_x = ' || e_to_x);
RETURN e_to_x;
END E_to_X;
/
DECLARE
N number;
BEGIN
N := E_to_X(5,3);
END;
/
2)
The goal of this problem is to load some health data from the government into our Oracle
Database and use it to answer a few questions. (This will be continued in the next homework.)
Go to: https://ephtracking.cdc.gov/
Click on Explore Data
STEP 1: CONTENT
Click on “Select Content Area” so that you get “Drinking Water”.
Choose “Public Water Use” on the second drop-down menu.
Choose “Annual Number of People Receiving Water” on the third drop-down menu.
STEP 2: GEOGRAPHY TYPE
National by State
STEP 3: GEOGRAPHY
All States
STEP 4: TIME
2022
2021
2020
2019
STEP 5: ADVANCED OPTIONS
No Advanced Options
Then download the data and save it as a DrinkingWater.CSV file. Look at the Map. Note the menu that lets you choose between the four years.
Ask yourself these NON-CREDIT questions: What state has the highest value? What state has the lowest value? What does the number mean? Why do you think the state(s) with the highest value(s) have the highest value? Even though these are non-credit questions, I would like you to attempt to write answers. If they are wrong, you don’t lose anything.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Related Questions
Write the following function in PYTHON
a) display_PHU_summary() takes three input parameters, a 2D-list (similar to database), a dictionary (similar to dict), and an integer for the PHU_ID. Your function must print the following information, the id, name, city, website, and the total number of cases reported at this PHU. If the given PHU_ID is invalid, it should print a message and exit the function.
>>> display_PHU_summary(database, dict, 2241) PHU id: 2241 PHU name: Kingston Frontenac and Lennox & Addington Public Health PHU city: Kingston, K7M 1V5 PHU website: www.kflaph.ca Total cases: 1 >>> display_PHU_summary(database, dict, 3895) PHU id: 3895 PHU name: Toronto Public Health PHU city: Toronto, M5B 1W2 PHU website: www.toronto.ca/community-people/health-wellness-care/ Total cases: 2 >>> display_PHU_summary(database, dict, 3800) The PHU Id is invalid
arrow_forward
6.23 LAB: Python insert/update sqlite3 datafiles
Given is a Python program that connects to a sqlite database and has one table called writers with two columnns:
name - the name of a writer
num - the number of works the writer has written
The writers table originally has the following data:
name, num Jane Austen,6 Charles Dickens,20 Ernest Hemingway,9 Jack Kerouac,22 F. Scott Fitzgerald,8 Mary Shelley,7 Charlotte Bronte,5 Mark Twain,11 Agatha Christie,73 Ian Flemming,14 J.K. Rowling,14 Stephen King,54 Oscar Wilde,1
Update the Python program to ask the user if they want to update entries or add new entries. If the name entered already exists in the writers table then the database record is updated, overwriting the original contents. If the name does not exist in the writers table, then add a new record with the writer's name and number of works. The following TODO sections must be completed.
Check if a writer exists in the writers table
If the writer exists in the table, locate an…
arrow_forward
6.23 LAB: Python insert/update sqlite3 datafiles Given is a Python program that connects to a sqlite database and has one table called writers with two columnns: name - the name of a writer num - the number of works the writer has written The writers table originally has the following data: name, num Jane Austen,6 Charles Dickens,20 Ernest Hemingway,9 Jack Kerouac,22 F. Scott Fitzgerald,8 Mary Shelley,7 Charlotte Bronte,5 Mark Twain,11 Agatha Christie,73 Ian Flemming,14 J.K. Rowling,14 Stephen King,54 Oscar Wilde,1 Update the Python program to ask the user if they want to update entries or add new entries. If the name entered already exists in the writers table then the database record is updated, overwriting the original contents. If the name does not exist in the writers table, then add a new record with the writer's name and number of works. The following TODO sections must be completed. Check if a writer exists in the writers table If the writer exists in the table, locate an…
arrow_forward
In C program
Create Student Library with the following components:
student_t : user-defined type (StudentID, FirstName, LastName, GPA).
scan_student() : function to read (StudentID, FirstName, LastName,
GPA).
print_student(): function to print a student’s information as follows:
Name: John SmithStudent
ID: 123456
GPA: 3.5
Create student.h, student.c and main-student.c
In main-student.c prompt the user to enter the information needed to create 2 student records then display them in the order they were entered.
arrow_forward
Jupyter Notebook
Fixed Income - Certicificate of Deposit (CD) - Compound Interest Schedule
An interest-at-maturity CD earns interest at a compounding frequency, and pays principal plus all earned interest at maturity.
Write a function, called CompoundInterestSchedule, that creates and returns a pandas DataFrame, where each row has: time (in years, an integer starting at 1), starting balance, interest earned, and ending balance, for an investment earning compoundedinterest.
Use a for(or while) loop to create this table. The equation for theith year's ending balance is given by:
Ei =Bi (1+r/f)f
where:
Ei is year i's ending balance
Bi is year i's beginning balance (note: B1 is the amount of the initial investment (principal)
r is the annual rate of interest (in decimal, e.g., 5% is .05)
f is the number of times the interest rate compounds (times per year)
The interest earned for a given year is Ei - Bi
Note the term of the investment (in years) is not in the above equation; it is used…
arrow_forward
Assuming the database to be an array of ten (8) books, construct a class called Books with relevant
data members and member functions that will allow one to:-
(i) Insert a new book record into the database
(ii) Display a list of all books in the database
(iii) Write a main function to test the program
arrow_forward
get_total_cases() takes the a 2D-list (similar to database) and an integer x from this set {0, 1, 2} as input parameters. Here, 0 represents Case_Reported_Date, 1 represents Age_Group and 2 represents Client_Gender (these are the fields on the header row, the integer value represents the index of each of these fields on that row). This function computes the total number of reported cases for each instance of x in the text file, and it stores this information in a dictionary in this form {an_instance_of_x : total_case}. Finally, it returns the dictionary and the total number of all reported cases saved in this dictionary.
arrow_forward
The following are your requirements:
make_dict(n)
Write a function called make_dict(n), where n is an integer parameter. With a given number n, make a new dictionary in your function where the keys in the dictionary are in the range from 1 to n, and value for each key is the square of the key for that entry. Your function should return this dictionary, not print it.
main()
Call make_dict(n), where the user is asked to specify a number to pass into make_dict(n), and then prints the returned dictionary object.
arrow_forward
What's the distinction between void and NULL pointers? Give appropriate examples to back up your answer. Give the distinctions in TABULAR form.
arrow_forward
It says there is an error in the class solution(the followup one), specifically in the read data function students[i].setGrade(); It says it is empty, but when I add the declaration char grade; to the function and change the statement to students[i].setGrade(grade); it still says there is an error. What does it need to be instead?
Here is my code:
#include <iostream>
#include <string>
using namespace std;
const int numstudents = 20;
class studentType
{
private:
string studentFName;
string studentLName;
int testscore;
char grade;
public:
void setName(string first, string last)
{
studentFName = first;
studentLName = last;
}
void setScore(int score)
{
testscore = score;
}
void setGrade(char grade)
{
if (testscore >= 90)
{
grade = 'A';
}
if (testscore <= 90 && testscore >= 80)…
arrow_forward
Write a function called login that accepts 3 parameters: userName:str, password: str, and data: dictionary. The data parameter is a dictionary containing userName keys and associated passwords for values. Your function is the check if the username and password passed by parameter are a matching key:value pair in the data dictionary.
in python
If the username is not a valid key in data it should return the string "The user name was not found"
If the password is not correct for a username that is found in the data dictionary it should return the string "The password was incorrect"
If the username is associated with a correct password it should return the string "Login successful"
You can create an empty dictionary with
dictionary()
[ ]
( )
{ }
This data structure stores a collection of objects in an unordered manner where each object must be unique
dictionary
set
tuple
list
arrow_forward
inal Project In this project, you will be asked to implement a simple Java program that will maintain its data using a specific NoSQL database called MongoDB. In this program you will be asked to maintain an object called Product, each product will have the following attributes: + Product ID. + Product Name. + Product Description. + Product Price. You will be asked to implement two types of products. « Dimensional Products. * Weighted Products. For the products of type Dimensional, they will have two extra values that express the width and the length of the product stored. For the products of type Weighted, they will have one extra value that express the weight of the product stored. When the program runs, the following choices appear. 1- Show all Products. 2- Add Product. 3- Delete Product. 4- Update Product. 5- Replace Product. 6- Search Product. 7-Bxit. Enter your choice: Notes: 1- When the program starts, it should connect automatically to a Database that is called “DBCourse” and a…
arrow_forward
Define the function lake_to_tli3_dict(readings) that takes a list of (lake_name, chla, tn, tp) tuples and returns a dict mapping lake names to trophic level index values. That is, the keys are lake names and the values will be TLI3 values.
Notes:
You will need to have import math as your first line of code.
You must include and use/call the trophic_level_index function that you wrote in Question 1.
trophic_level_index must still work as specified in Question 1.
Lakes should be added to the dictionary in the same order as they appear in the readings list.
If a lake appears in the readings list more than once, then the TLI for the last occurrence in the readings list should be the one that appears in the result. (This should happen naturally, since the lake name can only occur in the dictionary once.)
For example:
Test
Result
names_cnp_1 = [('Lake Brunner', 0.8, 218.0, 6.0), ('Lake Carrot', 5.1, 505.0, 18.5) ] tli3_dict = lake_to_tli3_dict(names_cnp_1 ) print(tli3_dict)…
arrow_forward
Complete this C++ code with the following requirements:
Write a program that will allow a user to enter students into a database. The student information should include full name, student ID, GPA and status. The program should allow delete any student based on student ID. Program must use linked list. No vectors or arrays. C++.
# include<iostream>using namespace std;class Node{ string full_name, status; int studentID; float GPA; Node* next;};Node* head= new Node();bool check (int x){ if(head==NULL){ return false; } Node* t=new Node(); t=head; while(t!=NULL){ if(t->studentID==x){ return true; t=t->next; } } return false;}void insert(int studentID, string full_name, string status, float GPA){ if(check(student_id)){ cout<<"Student already exists in the record"<<endl; return; } Node *t=new Node(); t->studentID=studentID; t->full_name=full_name;…
arrow_forward
Please follow the following Python code to complete this exercise:
"""PROGRAMMING ASSIGNMENT 07Filename: 'exercise1.py'"""# Place your imports here if any
def build_attraction_dict(filename): """ Read from the file for which the filename was given and returns a dictionary
The key / value pairs in the dictionary will be: • key → attraction name (str type) • value → Province (str type) """ # TODO
def add_attraction(dic): """ This function takes a dictionary as a parameter and does not return anything.
The function: • asks the user to input an attraction name • asks the user to input a province • updates the dictionary with a new key / value pair (with a similar format for task 1) """ # TODO
def build_province_attraction_dict(dic): """ This function takes a dictionary as a parameter and returns another dictionary.
The input dictionary is constituted of key / value pairs similar to the ones built in task…
arrow_forward
Please enumerate all of the situations when invoking inline functions will not get the expected results.
arrow_forward
There is only 1 ques with 2 part. Please answer the questions ( Answer in python )
Part I: Cities.
Write a function called describe_city which accepts the name of a city and its country. The function should print a simple sentence as shown in the output example. Give the parameter for the country a default value.
Make 5 calls to the function using the following arguments:
Reykjavik, Iceland
Pittsburg
Ontario, Canada
Cairo, Egypt
Miami, USA
Output Example : ( FOLLOW THE OUTPUT SAME AS GIVEN BELOW )
Reykjavik is in Iceland
Pittsburg is in USA
Ontario is in Canada
Cairo is in Egypt Miami
is in USA
Part II: Blastoff!!!
Write a function called count_down which has 1 integer parameter. The function should countdown from that parameter value to 1.
Each step in the countdown should be printed on the same line followed by ‘Blastoff!!!’ also on the same line. All of this should happen in the function. Make 3 calls to the function with the following arguments:
3
5
10
Output…
arrow_forward
THIS IS THE REFERNCE FOR COPY:Dictionarya) Define a function createUser() with an arbitrary dictionary parameter. This function returns a dictionary based upon input arguments.b) Define a function printUser() with a parameter user which is a dictionary. This function prints the contents of the dictionary user.c) Create and print the user: John, age 43, job Programmer, Hobby Bikingd) Create and print the user: Sara, age 20, school QCC, major CSIS
ANSWER THIS QUESTION:
Modulesa) Create a file userFunctions.py: 1. Copy nameFormat(), createUser(), and printUser() from the problems above into the userFunctions.py file. 2. Modify nameFormat() to accept only two parameters first and last. Change last to an optional parameter. This function should now return either first or last, first. 3. Define a function printUsers() which accepts a list parameter users. This function calls the printUser function to print all user data.b) Create a separate file, functionModule.py: 1. Import all functions…
arrow_forward
A python dictionary, Bank, is created to keep track of the Current Account and the Savings Account for each client in a bank. While the first item in the list is for the current account, the second item is for the savings account. The client’s name acts as the key for this dictionary.Bank = {"Apple":[100.0, 1500.0],"Bobby":[200.0, 4000.0],"Cathy":[150.0, 3500.0],"David":[300.0, 2500.0]}Write the following functions for the dictionary Bank to maintain the clients’ current and savings accounts.1. Function printBank( ): print out the contents of the dictionary Bank2. Function deposit(Name, account_type, amount): deposit the amount of money to the account specified by the account_type under the client’s name.3. Function withdraw(Name, account_type, amount): withdraw the amount of moneyfrom the account specified by the account_type under the client’s name.4. Function creatAccount(Name): create a new entry in the dictionary and initialize both the current and savings accounts to 0.0 under…
arrow_forward
Best Practices to Follow:
It’s worth breaking up each functional task in create_blackjack_game() into separate functions. For example, a function to check the score of a player’s hand, to check whether a player has won, and so on. This entire implementation can be done neatly in about eight functions.
Create a Deck of Cards
Complete the create_standard_deck() function, which creates a new deck. The deck itself must be a data structure list. The cards within the deck must be represented as tuples of the form (suit, number), where the suit is a string that must be either ‘hearts’, ‘clubs’, ‘spades’, or ‘diamonds’, and the number is an integer that must be one of the following: 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, or 14. Note that the number used to identify the card has the following association: Jack = 11, Queen = 12, King = 13, and Ace = 14. In terms of value, the picture cards (Jack, Queen, and King) all have a value of 10, and the Ace card has a value of 11. The casino only wants…
arrow_forward
in C++, pls put comments in the code
1. Create a 10x10 matrix using rand function to fill the said matrix with random numbers
2. Print all the numbers in matrix form
3. Ask the user the following options
here are the options
A. Sum per row
B. Sum per column
C. Display all ODD numbers horizontally
D. Display all EVEN numbers horizontally
E. Display all PRIME numbers horizontally
F. Generate new set of random numbers
G. Close the program
After asking what option to display, Display again the previous numbers entered and the same options.
arrow_forward
1. An iron manufacturing company maintains data about all of its employees, including every employee’s name, unique ID, age, native city, contact number, the department to which she or he belongs, and gross salary. The company wants a program that can sort the employees based on their native city in order to easily trace how many employees belong to the same region. Write a program module by using ‘strcmp’ to sort all the available names of cities in an ascending order. IN C PROGRAMMING LANGUAGE AND DON’T COPY AND PASTE THE ONE HERE IN BARTELBY BECAUSE ITS DONE IN C++ AND DOESN’T SOLVE THE PROBLEM RIGHT
arrow_forward
What's the distinction between void and NULL pointers? Give appropriate examples to back up your answer.
arrow_forward
Answer the given question with a proper explanation and step-by-step solution.
For this question use the file data1.csv
The file contains information on various customers. Each customer has a unique customer id. The data also has information on age income and Gender of the customers. Space can be used as a delimiter for this file.
Find the following:
A) The total number of the rows in the file.
B) The number of unique customer ids in the datafile. For this question create a set object which will only allow you to add unique customer ids.
C) The program asks user to provide an id and prints information about that customer.
Make sure to take care for the errors due to invalid id (i.e., id does not present in data). Print “id not found” when id is not found.
Save the file as Solution1.java. You can use either File Reader or Scanner classes to read the data in the csv file.
Your program should print the following after filling the blanks with the appropriate values Outcome:
The total…
arrow_forward
JAVA CODE PLEASE
Wave Background
CodyUniversity Logo
brightness_2
notifications
User
Details
Code
1. Functions With Parameters and Return Values Practice l
by CodeChum Admin
Create a function named compare that receives two character arguments and compares them. Return the integer ASCII value of the character that has the greater value.
In the main function, write a program that asks for two character inputs and assign them to their respective character variables. Call the compare function by passing in the two character variables and assign the returned value to a variable. On the next line, print the value assigned to the variable.
An initial code is provided for you. Just fill in the blanks.
Input
1. One line containing the first character
2. One line containing the second character
Output
Enter·first·character:·a
Enter·second·character:·h
Result·value·=·104
arrow_forward
In python
without using pandas, .head, .iloc, or .select
create a function that returns a dictionary of only the columns specified from a data set
example
car = {suv, sedan, coupe}
speed = {10, 20, 30]
color = {green, white, black}
if given the parameter of "color" should return a table with all values in color dictionary
arrow_forward
Complete the function solveMeFirst to compute the sum of two integers. In javascript
Example
Return .
Function Description
Complete the solveMeFirst function in the editor below.
solveMeFirst has the following parameters:
int a: the first value
int b: the second value
Returns- int: the sum of a and b
Constraints
1<a; b<1000;
process.stdin.resume();process.stdin.setEncoding('ascii');
var input_stdin = "";var input_stdin_array = "";var input_currentline = 0;
process.stdin.on('data', function (data) { input_stdin += data;});
process.stdin.on('end', function () { input_stdin_array = input_stdin.split("\n"); main(); });
function readLine() { return input_stdin_array[input_currentline++];}
function solveMeFirst(a, b) { return a + b; }
function main() { var a = parseInt(readLine()); var b = parseInt(readLine());;
var res = solveMeFirst(a, b); console.log(res);}
arrow_forward
C++ CODİNG. I want you to write some functions using given struct and please create a class. When you write functions you need to use pointers, ccreate linked list.
struct node {
char data;
node *right;
node *down;
}
First function has to Display all the rows starting with a specific character
Second function Display all the columns starting with a specific character
Third one Delete all the rows starting with a specific character.
And also You need to use header file. You do not need to write main function, as i said before ı just want to functions.
arrow_forward
Each function (function name plotNegXSquaredPlus25) should accept two integer parameters indicating the minimum and maximum X value to be plotted. The functions should have no return values. Create class-level constants for things we might wish to change later, e.g., a char called PLOT_CHAR that holds an “x” (per samples below), another char called FILL_CHAR that holds an unobtrusive character like ASCII 183, generated with a cast, e.g., (char)183.
JAVA PLEASE
THOSE ARE NOT PERIODS OR DOTS.
USE (System.out.print((Char)183); for (.)
Please DON'T USE Loops(while);, if, Arrays, lists, or other data structures, objects, libraries, or methods.
Sideways Ploty = -(x*x)+25 where -5<=x<=5x·········x················x
·····················x
························x
·························x
························x
·····················x
················x·········xxThe area under the plot is 165
arrow_forward
can you explain this code with details? only C programming
#include <stdio.h>#include <stdlib.h>#include <string.h>
// Function Declarationsvoid create_inventory();void update_vacc_qty();int search_vaccine();void display_vaccine();
// Main Function starts here
int main(){create_inventory();display_vaccine();search_vaccine();//update_vacc_qty();return 0;}
//Function to Create Vaccine.txt as per the given tablevoid create_inventory(){int option = 1;// variables to collect data as per table givenchar vaccinename[15];char vaccinecode[2];char country[15];int dosage;float populaion;
//File definitionFILE* infile;infile = fopen("Vaccine.txt","w"); // file opening for writingif (infile == NULL) // Checking for the file creation{printf("Vaccine.txt file unfamiliar\n");}
//Accepting data from user from keyboard till user enters 0 to closewhile (option != 0){printf("Enter Vaccine Name : ");scanf("%s", vaccinename);printf("Enter Vaccine Code : ");scanf("%s",…
arrow_forward
Focus on dictionary methods, use of functions, and good programming styleFor this assignment, you will create a glossary (dictionary) of technical terms and definitions. It will be set up as a Python dictionary structure. The file glossary_starter.py is a complete starter framework for the assignment. It includes some initial values for the dictionary. It is long because most of the code has already been written for you.Your task is to complete the five individual functions for adding and deleting terms, looking up terms, listing them, and printing out both the terms and definitions. These functions are all short, just a couple of lines, and use basic dictionary methods and techniques.
Here is some sample output.
Glossary system
1) Add a term
2) List terms
3) Get a definition
4) Delete a term
5) Print out dictionary
6) Quit
Enter your choice: 2
argument
dictionary
hashmap
list
set
5 terms
Glossary system
1) Add a term
2) List terms
3) Get a definition
4) Delete a term
5) Print…
arrow_forward
SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Related Questions
- Write the following function in PYTHON a) display_PHU_summary() takes three input parameters, a 2D-list (similar to database), a dictionary (similar to dict), and an integer for the PHU_ID. Your function must print the following information, the id, name, city, website, and the total number of cases reported at this PHU. If the given PHU_ID is invalid, it should print a message and exit the function. >>> display_PHU_summary(database, dict, 2241) PHU id: 2241 PHU name: Kingston Frontenac and Lennox & Addington Public Health PHU city: Kingston, K7M 1V5 PHU website: www.kflaph.ca Total cases: 1 >>> display_PHU_summary(database, dict, 3895) PHU id: 3895 PHU name: Toronto Public Health PHU city: Toronto, M5B 1W2 PHU website: www.toronto.ca/community-people/health-wellness-care/ Total cases: 2 >>> display_PHU_summary(database, dict, 3800) The PHU Id is invalidarrow_forward6.23 LAB: Python insert/update sqlite3 datafiles Given is a Python program that connects to a sqlite database and has one table called writers with two columnns: name - the name of a writer num - the number of works the writer has written The writers table originally has the following data: name, num Jane Austen,6 Charles Dickens,20 Ernest Hemingway,9 Jack Kerouac,22 F. Scott Fitzgerald,8 Mary Shelley,7 Charlotte Bronte,5 Mark Twain,11 Agatha Christie,73 Ian Flemming,14 J.K. Rowling,14 Stephen King,54 Oscar Wilde,1 Update the Python program to ask the user if they want to update entries or add new entries. If the name entered already exists in the writers table then the database record is updated, overwriting the original contents. If the name does not exist in the writers table, then add a new record with the writer's name and number of works. The following TODO sections must be completed. Check if a writer exists in the writers table If the writer exists in the table, locate an…arrow_forward6.23 LAB: Python insert/update sqlite3 datafiles Given is a Python program that connects to a sqlite database and has one table called writers with two columnns: name - the name of a writer num - the number of works the writer has written The writers table originally has the following data: name, num Jane Austen,6 Charles Dickens,20 Ernest Hemingway,9 Jack Kerouac,22 F. Scott Fitzgerald,8 Mary Shelley,7 Charlotte Bronte,5 Mark Twain,11 Agatha Christie,73 Ian Flemming,14 J.K. Rowling,14 Stephen King,54 Oscar Wilde,1 Update the Python program to ask the user if they want to update entries or add new entries. If the name entered already exists in the writers table then the database record is updated, overwriting the original contents. If the name does not exist in the writers table, then add a new record with the writer's name and number of works. The following TODO sections must be completed. Check if a writer exists in the writers table If the writer exists in the table, locate an…arrow_forward
- In C program Create Student Library with the following components: student_t : user-defined type (StudentID, FirstName, LastName, GPA). scan_student() : function to read (StudentID, FirstName, LastName, GPA). print_student(): function to print a student’s information as follows: Name: John SmithStudent ID: 123456 GPA: 3.5 Create student.h, student.c and main-student.c In main-student.c prompt the user to enter the information needed to create 2 student records then display them in the order they were entered.arrow_forwardJupyter Notebook Fixed Income - Certicificate of Deposit (CD) - Compound Interest Schedule An interest-at-maturity CD earns interest at a compounding frequency, and pays principal plus all earned interest at maturity. Write a function, called CompoundInterestSchedule, that creates and returns a pandas DataFrame, where each row has: time (in years, an integer starting at 1), starting balance, interest earned, and ending balance, for an investment earning compoundedinterest. Use a for(or while) loop to create this table. The equation for theith year's ending balance is given by: Ei =Bi (1+r/f)f where: Ei is year i's ending balance Bi is year i's beginning balance (note: B1 is the amount of the initial investment (principal) r is the annual rate of interest (in decimal, e.g., 5% is .05) f is the number of times the interest rate compounds (times per year) The interest earned for a given year is Ei - Bi Note the term of the investment (in years) is not in the above equation; it is used…arrow_forwardAssuming the database to be an array of ten (8) books, construct a class called Books with relevant data members and member functions that will allow one to:- (i) Insert a new book record into the database (ii) Display a list of all books in the database (iii) Write a main function to test the programarrow_forward
- get_total_cases() takes the a 2D-list (similar to database) and an integer x from this set {0, 1, 2} as input parameters. Here, 0 represents Case_Reported_Date, 1 represents Age_Group and 2 represents Client_Gender (these are the fields on the header row, the integer value represents the index of each of these fields on that row). This function computes the total number of reported cases for each instance of x in the text file, and it stores this information in a dictionary in this form {an_instance_of_x : total_case}. Finally, it returns the dictionary and the total number of all reported cases saved in this dictionary.arrow_forwardThe following are your requirements: make_dict(n) Write a function called make_dict(n), where n is an integer parameter. With a given number n, make a new dictionary in your function where the keys in the dictionary are in the range from 1 to n, and value for each key is the square of the key for that entry. Your function should return this dictionary, not print it. main() Call make_dict(n), where the user is asked to specify a number to pass into make_dict(n), and then prints the returned dictionary object.arrow_forwardWhat's the distinction between void and NULL pointers? Give appropriate examples to back up your answer. Give the distinctions in TABULAR form.arrow_forward
- It says there is an error in the class solution(the followup one), specifically in the read data function students[i].setGrade(); It says it is empty, but when I add the declaration char grade; to the function and change the statement to students[i].setGrade(grade); it still says there is an error. What does it need to be instead? Here is my code: #include <iostream> #include <string> using namespace std; const int numstudents = 20; class studentType { private: string studentFName; string studentLName; int testscore; char grade; public: void setName(string first, string last) { studentFName = first; studentLName = last; } void setScore(int score) { testscore = score; } void setGrade(char grade) { if (testscore >= 90) { grade = 'A'; } if (testscore <= 90 && testscore >= 80)…arrow_forwardWrite a function called login that accepts 3 parameters: userName:str, password: str, and data: dictionary. The data parameter is a dictionary containing userName keys and associated passwords for values. Your function is the check if the username and password passed by parameter are a matching key:value pair in the data dictionary. in python If the username is not a valid key in data it should return the string "The user name was not found" If the password is not correct for a username that is found in the data dictionary it should return the string "The password was incorrect" If the username is associated with a correct password it should return the string "Login successful" You can create an empty dictionary with dictionary() [ ] ( ) { } This data structure stores a collection of objects in an unordered manner where each object must be unique dictionary set tuple listarrow_forwardinal Project In this project, you will be asked to implement a simple Java program that will maintain its data using a specific NoSQL database called MongoDB. In this program you will be asked to maintain an object called Product, each product will have the following attributes: + Product ID. + Product Name. + Product Description. + Product Price. You will be asked to implement two types of products. « Dimensional Products. * Weighted Products. For the products of type Dimensional, they will have two extra values that express the width and the length of the product stored. For the products of type Weighted, they will have one extra value that express the weight of the product stored. When the program runs, the following choices appear. 1- Show all Products. 2- Add Product. 3- Delete Product. 4- Update Product. 5- Replace Product. 6- Search Product. 7-Bxit. Enter your choice: Notes: 1- When the program starts, it should connect automatically to a Database that is called “DBCourse” and a…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr