Consider the following relational database schema:
employee(employee-name, employee-id, street, e-city)
works(employee-id, company-id, salary)
company(company-name, company-id, c-city)
manages(employee-id, manager-id)
Specify the following queries on this database schema using the relational operators we discussed in class. Write your answers on a separate sheet of paper in the order that they are specified below.
In: Computer Science
1) Write a python program that opens a file, reads
all of the lines into a list of strings, and closes the file. Use
the Readlines() method. Test your programing using the names.txt
file provided.
2) Convert the program into a function called loadFile, that
receives the file name as a parameter and returns a list of
strings.
3) Write a main routine that calls loadFIle three times to load the
three data files given into three lists. Then choose a random
element from the title list, two from the name list, and one from
the descriptor list to generate a name. Print the name be in the
form shown (you have to add the "the"):
title name name the descriptor
For example:
King Ludovicus Botolf the Bowman
Print the name to the screen.
Submit your python file (.py) to Sakai
Part 2: Writing Files (Optional Extra Credit 20 pts)
Modify the program to generate 10 names and store them in a
list.
Write a function, dumpFile that writes the list to a file called
"CharacterNames.txt" There should be one Character Name on each
line in the file.
Test the program to be sure it works
Im stumped at number 2
here is what i have for number 1
f = open('names.txt', 'r')
lines = f.readlines()
for line in range(len(lines)):
lines[line] = lines[line].rstrip()
print(lines)
f.close()
In: Computer Science
Create a for which will have the following controls.
1. Label for First Name and TextBox for the First Name
2. Label for Last Name and TextBox for the Last Name
3. Label for bank account balance and TextBox for the bank account balance (assume $1000 in the bank account)
4. Create a button Name. The user will click the button and the first name and last name will be displayed on the label. You will create a label called lblFirstLastName to display the First and last Name.
5. Create a button bankbalance. The user will click the button and the balance will be displayed on the label. You will create a label called lblBankbalance to display the bank balance.
6. Create a Cancel button to cancel the form
------------------------------------------------------------------------------------------------
package swing;
import javax.swing.*;
public class SwingInheritance extends JFrame
{
private static final long serialVersionUID = 1L;
SwingInheritance()
{
JTextField userName = new
JTextField();
//userName.setBounds(x, y, width,
height);
userName.setBounds(80,100,100,
40);
userName.setText("Hello");
JLabel lblText = new
JLabel();
lblText.setBounds(80,150,300,
40);
lblText.setText("You Entered: " +
userName.getText());
JButton button=new
JButton("click");
//create button
button.setBounds(80,200,100,
40);
JButton close = new
JButton("Close");
close.setBounds(80,250,100,
40);
close.addActionListener(e
->
{
dispose();
});
//add to JFrame
add(button);
add(close);
add(userName);
add(lblText);
//set frame properties
setSize(400,500);
setLayout(null);
setVisible(true);
}
public static void main(String[] args)
{
new SwingInheritance();
}
}
In: Computer Science
JAVA Program
Create a class called SoccerPlayer
Create 4 private attributes: First Name, Last Name, Games, and Goals
Have two constructors
Constructor 1 – default constructor; all values to "NONE" or zero
Constructor 2 – accepts input of first name, last name, games and goals.
Create get and set methods for each of the four attributes
Create a method the returns a double that calculates the average goals per game
This method checks for zero games played:
If there are zero played, display an error and set average to 0;
If greater than zero, do the math and set average to result of calculation
Create a test program that allows you to set the first name, last name, number of games and number of goals. Call it SoccerPlayerTest.
Create two instances of players.
The first should use the default constructor and the set methods to fill the attributes
The second should use the other constructor to set the attributes
Display the info about the players including the average goals per game.
Use the same SoccerPlayer class you created in CE-SoccerPlayer
Create a test program that allows you to enter in the first name, last name, number of games and number of goals. Call it SoccerPlayerTest.
Create an array of players. There should be three players.
Create a loop and ask for the information about each player.
Create a loop and display the info about the players including the average goals per game
In: Computer Science
2. Write python code for the below instructions (don’t forget to use the keyword “self” where appropriate in your code):
A. Define a Parent Class called Person
a. Inside your Person class, define new member variables called name, age, and gender. Initialize these variables accordingly.
b. Define the constructor to take the following inputs: name, age, and gender. Assign these inputs to member variables of the same name.
B. Define Child Class called Employee that inherits from the Person Class
a. Inside your Child class, define new member variables called title and salary. Initialize these variables accordingly.
b. Define the constructor to take the following inputs: name, age, gender, title, and salary. Assign these inputs to Class member variables of the same name. Note, you will need to specifically call the Parent constructor method inside the Child constructor, passing the appropriate inputs to the Parent constructor.
C. Instantiate an Employee object called George with the following inputs: name = “George”, age = 30, gender = “Male”, title = “Manager”, and salary = 50000.
D. Print out the object’s name, age, gender, title, and salary in one print statement to the console window. Your output should look like:
“George's info is: Name is George, Age is 30, Gender is Male, Title is Manager, and Salary is 50000”
In: Computer Science
Fitting Logistic Reegression (depedent varaible(Employed), Independent variables (Age, Race.Ethnicities, Education.Attainment, gender)
dataset
| Age | Earnings Past 12 Months | Usual Weekly Hours | Female | Married | No High School Degree | High School Degree or GED | Some College | Associates Degree | Bachelors Degree | Masters Degree | Professional Degree | Doctorate | Educational Attainment | Employed | White | Black | American Indian or Native American | Asian | Hawaiian or Pacific Islander | Other Race | Biracial | Hispanic | Race/Ethnicity | Worked 40+ Weeks During Past 12 Months | Worked 35+ Hours in a Typical Week | |||
| 18 | 1200 | 16 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | No High School Degree | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | White | 0 | 0 | |||
| 53 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | High School Degree | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | Hispanic | 0 | 0 | ||||
| 61 | 0 | 70 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | Some College | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | White | 1 | 1 | |||
| 32 | 350 | 24 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | Some College | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | White | 0 | 0 | |||
| 49 | 0 | 30 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | Masters Degree | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | White | 1 | 0 | |||
In: Statistics and Probability
in JAVA, Hash table
The goal is to count the number of common elements between two sets. Download the following data sets, and add them to your project:
These files contain lists of the 1,000 most popular boy and girl names in the US for 2016, as compiled by the Social Security Administration. Each line of the file consists of a first name, and the number of registered births that year using that name.
Your task is to determine which names appeared on BOTH the boys list and girls list. We want a list of the most popular baby names that could be used for either a girl or a boy (ex. Alex or Drew).
Create a Driver class, and in the main method, use the following algorithm:
girlName2016.txt:
| Emma 19414 |
| Olivia 19246 |
| Ava 16237 |
| Sophia 16070 |
| Isabella 14722 |
| Mia 14366 |
| Charlotte 13030 |
| Abigail 11699 |
| Emily 10926 |
| Harper 10733 |
| Amelia 10702 |
| Evelyn 10060 |
| Elizabeth 9493 |
| Sofia 9134 |
| Madison 8982 |
| Avery 8733 |
| Ella 7866 |
| Scarlett 7680 |
| Grace 7531 |
| Chloe 7410 |
| Victoria 7267 |
| Riley 7110 |
| Aria 6904 |
| Lily 6558 |
| Aubrey 6507 |
| Zoey 6414 |
| Penelope 6367 |
| Lillian 6333 |
| Addison 6295 |
| Layla 6234 |
| Natalie 6156 |
| Camila 6036 |
| Hannah 5976 |
| Brooklyn 5922 |
| Zoe 5706 |
| Nora 5561 |
| Leah 5380 |
| Savannah 5336 |
| Audrey 5330 |
| Claire 5190 |
| Eleanor 5100 |
| Skylar 5099 |
| Ellie 5045 |
| Samantha 4924 |
| Stella 4912 |
| Paisley 4839 |
| Violet 4837 |
| Mila 4802 |
| Allison 4762 |
| Alexa 4760 |
boyName2016.txt
| Noah 19015 |
| Liam 18138 |
| William 15668 |
| Mason 15192 |
| James 14776 |
| Benjamin 14569 |
| Jacob 14416 |
| Michael 13998 |
| Elijah 13764 |
| Ethan 13758 |
| Alexander 13321 |
| Oliver 12975 |
| Daniel 12839 |
| Lucas 12838 |
| Matthew 12551 |
| Aiden 12158 |
| Jackson 11210 |
| Logan 11200 |
| David 11028 |
| Joseph 10823 |
| Samuel 10492 |
| Henry 10323 |
| Owen 10249 |
| Sebastian 10249 |
| Gabriel 10142 |
| Carter 10134 |
| Jayden 10063 |
| John 9952 |
| Luke 9930 |
| Anthony 9815 |
| Isaac 9671 |
| Dylan 9657 |
| Wyatt 9514 |
| Andrew 9324 |
| Joshua 9138 |
| Christopher 9020 |
| Grayson 8622 |
| Jack 8367 |
| Julian 8333 |
| Ryan 8215 |
| Jaxon 8054 |
| Levi 8009 |
| Nathan 7933 |
| Caleb 7914 |
| Hunter 7613 |
| Christian 7584 |
| Isaiah 7454 |
| Thomas 7309 |
| Aaron 7118 |
| Lincoln 7076 |
In: Computer Science
In this project, you will create a Visual Basic solution to perform customer billing at the Cyberian Internet Cafe. Please see below for the detailed instructions. You will create the project and then design a form using the image provided here. Then, add the necessary code to do the billing calculation and display the amount due.
Instructions
In this case, you will create a Visual Basic solution that performs customer billing for the Cyberian Internet Café. The Cyberian Internet Café provides Internet access to its customers on an hourly basis. One hour of Internet access costs $12.00. You will create a solution with a splash screen, which is an application that calculates the total cost for a customer, using the image file included in the downloaded files.
Step 1: Create the Project:
Create a Visual Basic Project using the project name “InternetCafe”.
Step 2 – Design the Form:
Design the form shown in Figure 1. You will need three button controls, three text boxes, one picture box control, and five label controls. Name your controls as shown in Table 1, and set the properties as indicated.
|
Type of Control |
Property |
Property value |
|
Form |
Name |
MainForm |
|
Text |
Customer Billing |
|
|
StartPosition |
CenterScreen |
|
|
Label |
Name |
Label1 |
|
Text |
Cyberian Internet Café |
|
|
Font.Size |
20 |
|
|
Button |
Name |
calculateButton |
|
Text |
Calculate |
|
|
Button |
Name |
clearButton |
|
Text |
Clear |
|
|
Button |
Name |
exitButton |
|
Text |
Exit |
|
|
Label |
Name |
Label2 |
|
Text |
Last Name |
|
|
Label |
Name |
Label3 |
|
Text |
First Name |
|
|
Label |
Name |
Label4 |
|
Text |
Number of hours |
|
|
Label |
Name |
Label5 |
|
Text |
Amount due |
|
|
Label |
Name |
amountDueLabel |
|
BorderStyle |
FixedSingle |
|
|
BackColor |
White (web color) |
|
|
PictureBox |
Name |
PictureBox1 |
|
Size.Width |
174 |
|
|
Size.Height |
174 |
|
|
BorderStyle |
FixedSingle |
|
|
Image |
(use the downloaded image file |
|
|
TextBox |
Name |
lastNameTextBox |
|
TextBox |
Name |
firstNameTextBox |
|
TextBox |
Name |
hoursTextBox |
Table 1 – MainForm Controls and Their Property Values
Step 3 – Add the image to the project’s Debug folder:
Copy the image files (J0195384.jpg) that you downloaded as part of this Case’s files into the following folder of your project:
C:\InternetCafe\ InternetCafe\bin\Debug
(If your drive letter is different than C:, use your drive letter.)
Step 4 – Add code to perform the calculation and display the amount due:
Step 5 – Create a splash screen
Create a splash screen using the Project menu - Add Windows Form. Select the Splash Screen form template.
Also change the splash window title to "Internet Cafe". reference : textbook page 114.
Set project properties:
Set the project’s startup form to be MainForm. Set the project’s splash screen to be SplashScreen.
Step 6: Save and run
Save all files, then start the application. Try entering data and using the Calculate button. Is the result formatted as currency?
In: Computer Science
|
Using the information below, complete the tax form 1040 above. Brian and Sheila Williams were married in October of 2008. They live at 1000 Main Street, Atlanta, GA 33127. Brian is a postal service worker. Sheila is a teacher at Grady High School. Brian’s social security number is 555-11-1111 and Sheila’s social security number is 555-22-2222. They have a dependent daughter Jayla who is 10 years old (Born on May 12th). Jayla’s social security number is 555-33-3333. In 2016, Brian's wages was $45,860 while Sheila's was $43,590. |
||||||||||
| Included or Excluded Items | ||||||||||
| Two years ago, the taxpayer loaned a friend $2000. The friend has filed for bankruptcy this year and will not be able to repay | ||||||||||
| Earned $100 interest on county municipal bonds | ||||||||||
| Found a diamond worth $1000 on the ground | ||||||||||
| Received $500 in death benefits fron Brian's father | ||||||||||
| Received $4,000 court settlement. $1,000 was punitive damanges. | ||||||||||
| Brian paid $400/month in child support | ||||||||||
| Received a $1000 gift from his brother | ||||||||||
| Sheila won $100 playing bingo | ||||||||||
| Brian paid $200/month in alimony to his ex-wife | ||||||||||
| Sheila received a $1000 gift from her mother | ||||||||||
| Sheila spent $300 on supplies for her classroom | ||||||||||
| Portfolio Investments | ||||||||||
| Stock | Acquired | Sold | Sales Price | Cost (Basis) | Qualified Dividends | |||||
| Red Stock | 2/1/2016 | 10/5/2016 | $6,000 | $2,500 | $0 | |||||
| White Stock | 6/11/2009 | 10/15/2016 | $5,000 | $4,000 | $100 | |||||
| Blue Stock | 10/1/2005 | 8/3/2016 | $2,000 | $10,000 | $0 | |||||
| Black Stock | 3/6/2016 | 12/15/2016 | $3,000 | $5,000 | $0 | |||||
| Yellow Stock | 4/5/2006 | N/A | N/A | $5,000 | $300 | |||||
| Interest Income Source | Amount | |||||||||
| Money Market Account | $200 | |||||||||
| Savings Account | $25 | |||||||||
| State Municipal Bonds | $35 | |||||||||
| Rental Property | ||||||||||
| They own and rent two pieces of residential real estate in Miami, FL. These properties were acquired with cash (so there are no mortgages on the homes). They both have real estate broker licenses in Georgia and Florida. They dedicate enough hours (through their business) to qualify as a “real estate professional” with regard to these properties. | ||||||||||
| Property 1 | ||||||||||
| The first property is located at 17750 NW 17th Ave, Miami, FL. They collect $1,000 monthly in rent. The property was purchased June 30, 2016 for $150,000. The tax records show that the value of the land is $30,000 and the value of the home was $90,000 when purchased. They actively participate in the management of the real property. | ||||||||||
| The property has the following expenditures: | ||||||||||
| Property tax | $7,000/yr | |||||||||
| Repairs | $ 900/yr | |||||||||
| Insurance | $1,200/yr | |||||||||
| Washing Machine | $300 | (purchased 6/2/2015) | ||||||||
| Refrigerator | $700 | (purchased 7/1/2016) | ||||||||
| Furniture | $2,000 | (purchased 4/1/2014) | ||||||||
| Property 2 | ||||||||||
| The second property is located at 5610 NW 11th Ave, Miami, FL. They collect $1,500 monthly in rent. The property was purchased on June 12, 2016 for $100,000. The tax records show that the value of the land is $20,000 and the value of the home was $80,000 when purchased. They actively participate in the management of the real property. | ||||||||||
| The property has the following expenditures: | ||||||||||
| Property tax | $6,200/yr | |||||||||
| Repairs | $3,000/yr | |||||||||
| Insurance | $1,200/yr | |||||||||
| Legal fees | $ 500/yr | |||||||||
| Advertising Expense | $ 500/yr | |||||||||
In: Advanced Math
|
Tru Developers, Inc., sells plots of land for industrial development. Tru recognizes income for financial reporting purposes in the year it sells the plots. For some of the plots sold this year, Tru took the position that it could recognize the income for tax purposes when the installments are collected. Income that Tru recognized for financial reporting purposes in 2016 for plots in this category was $60 million. The company expected to collect 60% of each sale in 2017 and 40% in 2018. This amount over the next two years is as follows: |
| |
|||
| 2017 | $ | 36 | million |
| 2018 | 24 | million | |
| $ | 60 | million | |
|
Tru’s pretax accounting income for 2016 was $105 million. In its income statement, Tru reported interest income of $10 million, unrelated to the land sales, for which the company’s position is that the interest is not taxable. Accordingly, the interest was not reported on the tax return. There are no differences between accounting income and taxable income other than those described above. The enacted tax rate is 40 percent. |
|
Management believes the tax position taken on the land sales has a greater than 50% chance of being upheld based on its technical merits, but the position taken on the interest has a less than 50% chance of being upheld. It is further believed that the following likelihood percentages apply to the tax treatment of the land sales ($ in millions): |
|
Amount Qualifying for Installment Sales Treatment |
Percentage Likelihood of Tax Treatment Being Sustained |
||||
| $ | 60 | 20 | % | ||
| 50 | 20 | % | |||
| 40 | 20 | % | |||
| 30 | 20 | % | |||
| 20 | 20 | % | |||
| Required: |
| 1. |
What portion of the tax benefit of tax-free interest will Tru recognize on its 2016 tax return? (Enter your answers in millions (i.e., 10,000,000 should be entered as 10).) |
| 2. |
What portion of the tax benefit of tax-free interest will Tru recognize on its 2016 financial statements?(Enter your answers in millions (i.e., 10,000,000 should be entered as 10).) |
| 3-1. |
What portion of the tax on the $60 million income from the plots sold on an installment basis will Tru defer on its 2016 tax return? (Enter your answers in millions (i.e., 10,000,000 should be entered as 10).) |
| 3-2. |
What portion of the tax on the $60 million income from the plots sold on an installment basis will Tru defer in its 2016 financial statements? (Enter your answers in millions (i.e., 10,000,000 should be entered as 10).) |
| 4. |
Prepare the journal entry to record income taxes in 2016 assuming full recognition of the tax benefits in the financial statements of both differences between pretax accounting income and taxable income. (If no entry is required for a transaction/event, select "No journal entry required" in the first account field. Enter your answers in millions (i.e., 10,000,000 should be entered as 10).) |
||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Note: Enter debits before credits.
|
In: Accounting