Questions
1. Create a1. Create a new java file named Name.java that should have Name class based...

1. Create a1. Create a new java file named Name.java that should have Name class based on new java file named Name.java that should have Name class based on the following UML

Name

- first: String

- last: String

+ Name ()

+ Name (String firstName, String lastName)

+ getName () : String

+ setName (String firstName, String lastName) : void

+ getFirst () : String

+ setFirst (String firstName) : void

+ getLast () : String

+ setLast (String lastName) : void

+ printName () : void

Notes: Name() constructor should call the other constructor to set blank values for first and last variables; getName should call getFirst and getLast; setName should call setFirst and setLast; printName should call getName and then print the name in the following format (assuming that values of Rahul & Dewan were used to create the Name object) – Hello Rahul Dewan, Welcome to CIS1500 Course ! If the name is blank, it should display message like: Name is blank !

In: Computer Science

How do you use header files on a program? I need to separate my program into...

How do you use header files on a program?

I need to separate my program into header files/need to use header files for this program.Their needs to be 2-3 files one of which is the menu. thanks!

#include
#include
#include

using namespace std;

const int maxrecs = 5;

struct Teletype

{

string name;
string phoneNo;

Teletype *nextaddr;

};

void display(Teletype *);
void populate(Teletype *);
void modify(Teletype *head, string name);
void insertAtMid(Teletype *, string, string);
void deleteAtMid(Teletype *, string);
int find(Teletype *, string);
bool is_phone_no(string);

int main()

{

Teletype *list, *current;

string name;
string phoneNo;
int menu;

list = new Teletype; //new reserves space and returns the adress to the list

current = list;

for (int i = 0; i < maxrecs - 1; i++)
{
populate(current);
current->nextaddr = new Teletype;
current = current->nextaddr;
}

populate(current);
current->nextaddr = NULL;
cout << "The contents of the linked list is: " << endl;
display(list);

cout << "\nPlease select a number from the menu: " << endl;
cout << "(1)Insert new Structure on the linked list." << endl;
cout << "(2)Modify an existing structure in the Linked list." << endl;
cout << "(3)Delete an existing structure in the Linked list." << endl;
cout << "(4)Find an existing Structure from the Linked list." << endl;
cout << "(5)Exit the program." << endl;

cin >> menu;

switch (menu)
{
case 1: cout << "Enter Name and number" << endl;
cin >> name >> phoneNo;
insertAtMid(list, name, phoneNo);
cout << "The contents of the link list after inserting: " << endl;
display(list);
break;
case 2: cout << "\nName of the person you need to modify: ";
cin >> name;
modify(list, name);
display(list);
break;
case 3: cout << endl;
cout << "Enter Name " << endl;
cin >> name;
deleteAtMid(list, name);
cout << endl;
cout << "The contents of the linked list after deleting is: " << endl;
display(list);
break;
case 4: cout << endl<< endl;
cout << "Enter a name (last, first): ";
getline(cin, name); // getline because of the namespace
if (!find(list, name))
{
cout << "The name is not in the current phone list" << endl;
}
break;
case 5: break;
}

return 0;

}

void insertAtMid(Teletype *head, string name, string phone)
{
Teletype *tmp = new Teletype();
tmp->name = name;
tmp->phoneNo = phone;
tmp->nextaddr = head->nextaddr;
head->nextaddr = tmp;
}

void deleteAtMid(Teletype *head, string name)
{
while (head->nextaddr != NULL)
{
if (head->nextaddr->name == name)
{
Teletype *del = head->nextaddr;
head->nextaddr = head->nextaddr->nextaddr;
delete del;
}
head = head->nextaddr;
}
}

void display(Teletype *contents)
{
while (contents != NULL)
{
cout << endl
<< setw(30) << contents->name << setw(20) << contents->phoneNo;
contents = contents->nextaddr;
}
}

int find(Teletype *contents, string name)
{
int found = 0;
while (contents != NULL)
{
if (contents->name == name)
{
found = 1;
cout << setw(30) << contents->name << setw(20) << contents->phoneNo;
break;
}
else
{
contents = contents->nextaddr;
}
}
cout << endl;
return found;
}

void modify(Teletype *head, string name)
{
string phone;
while (head->nextaddr != NULL)
{
if (head->nextaddr->name == name)
{
cout << "Enter new name and phoneNumber: ";
cin >> name >> phone;
head->nextaddr->name = name;
head->nextaddr->phoneNo = phone;
return;
}
head = head->nextaddr;
}
cout << "No suchrecord found\n";
}

bool is_phone_no(string phoneNo)
{
for (auto it = phoneNo.begin(); it != phoneNo.end(); it++)
{
if (*it > '9' || *it < '0')
return false;
}
return true;
}

void populate(Teletype *record)
{
cout << "Enter a name: ";
getline(cin, record->name);
string phoneNo;
while (true)
{
cout << "Enter the phone number: ";
getline(cin, phoneNo);
try
{
if (!is_phone_no(phoneNo))
{
throw "Exception caught! Invalid phone number\n";
}
record->phoneNo = phoneNo;
break;
}
catch (const char *e)
{
cout << e;
}
}

return;
}

In: Computer Science

Could someone please tell me what corrections I should make to this code. (Python) Here are...

Could someone please tell me what corrections I should make to this code. (Python)

Here are the instructions.

  • Modify the program so it contains four columns: name, year, price and rating (G,PG,R…)
  • Enhance the program so it provides a find by rating function that lists all of the movies that have a specified rating

I can't get the find function to work and I have no idea how to even go about it. For example, when type in 'find' and I enter the rating, I'm always getting an error. I need help.


def list(movie_list):
if len(movie_list) == 0:
print("There are no movies in the list.\n")
return
else:
i = 1
for row in movie_list:
print(str(i) + ". " + row[0]+ " (" + str(row[1]) + ")"+","+ "$"+str(row[2])+","+str(row[3]))
i += 1
print()

def add(movie_list):
name = input("Name: ")
year = input("Year: ")
price = int(input("Price:"))#price
rating =input("Rating:")
movie = []
movie.append(name)
movie.append(year)
movie.append(price)#adding price to the movie list
movie.append(rating)#adding rating to the movie list
movie_list.append(movie)
rating_list.append(movie)
print(movie[0] + " was added.\n")   

def delete(movie_list):
number = int(input("Number: "))
if number < 1 or number > len(movie_list):
print("Invalid movie number.\n")
else:
movie = movie_list.pop(number-1)
print(movie[0] + " was deleted.\n")
#find by rating function
def find_by_rating(movie_list,rating):
if len(movie_list)==0:
print("Find")
return
else:
movie_list=[]
for i in movie_list:
if i[3]==rating:
movie_list.append(i[0])
if len(1)==0:
print("No movies are present with given rating")
else:
print("Movies:")
for i in movie_list:
print(i)
  
  
def display_menu():
print("COMMAND MENU")
print("list - List all movies")
print("add - Add a movie")
print("del - Delete a movie")
print("find- find movie by rating")
print("exit - Exit program")
print()

def main():
movie_list = [["Matrix",1999,9.75,"R"],
["Under the Tuscan",2003,4.99,"PG"],
["V for Vendetta", 2005,14.99,"R"]]

display_menu()
  
while True:
command = input("Command: ")
if command == "list":
list(movie_list)
elif command == "add":
add(movie_list)
elif command == "del":
delete(movie_list)
elif command == "find": #added find command
rating=input("Enter rating:")#taking the rating
find_by_rating(movie_list,rating)#the call
elif command == "exit":
break
else:
print("Not a valid command. Please try again.\n")
print("Bye!")

if __name__ == "__main__":
main()

In: Computer Science

Suppose a basket of goods and services has been selected to calculate the CPI and 2014...

Suppose a basket of goods and services has been selected to calculate the CPI and 2014 has been selected as the base year. In 2012, the basket's cost was $50; in 2014, the basket's cost was $52; and in 2016, the basket's cost was $58. The value of the CPI in 2016 was _____?

In: Economics

Inventory for Charles Smart company is as follows: 2015 Current Cost 200000.00 Index 1.00 2016 Current...

Inventory for Charles Smart company is as follows:

2015 Current Cost 200000.00 Index 1.00

2016 Current Cost 230000.00 Index 1.20

2017 Current Cost 250000.00 Index 1.40

Compute dollar value LIFO for 2015, 2016, and 2017

In: Accounting

On August 1, 2016, Pereira Corporation has sold, on account, 1,600 Wiglows to Mendez Company at...

On August 1, 2016, Pereira Corporation has sold, on account, 1,600 Wiglows to Mendez Company at $450 each. Mendez also purchased a 1-year service-type warranty on all the Wiglows for $12 per unit. In 2016, Pereira incurred warranty costs of $9,200. Costs for 2017 were $7,000.

Required:

1. Prepare the journal entries for the preceding transactions.
2. Show how Pereira would report the items on the December 31, 2016, balance sheet.
CHART OF ACCOUNTS
Pereira Corporation
General Ledger
ASSETS
111 Cash
121 Accounts Receivable
141 Inventory
152 Prepaid Insurance
181 Equipment
189 Accumulated Depreciation
LIABILITIES
211 Accounts Payable
230 Unearned Warranty Revenue
231 Salaries Payable
250 Unearned Revenue
261 Income Taxes Payable
EQUITY
311 Common Stock
331 Retained Earnings
REVENUE
411 Sales Revenue
438 Warranty Revenue
EXPENSES
500 Cost of Goods Sold
511 Insurance Expense
512 Utilities Expense
521 Salaries Expense
532 Bad Debt Expense
540 Interest Expense
541 Depreciation Expense
551 Warranty Expense
559 Miscellaneous Expenses
910 Income Tax Expense

Prepare the necessary journal entries to record:

1. the sale of Wiglows and service warranty on account on August 1, 2016
2. the warranty costs paid during 2016
3. the warranty revenue earned in 2016
4. the warranty costs paid during 2017
5. the warranty revenue earned in 2017
Additional Instructions

PAGE 9

GENERAL JOURNAL

DATE ACCOUNT TITLE POST. REF. DEBIT CREDIT

1

2

3

4

5

6

7

8

9

10

11

Show how Pereira would report the items on the December 31, 2016, balance sheet. Additional Instructions

Pereira Corporation

Partial Balance Statement

December 31, 2016

1

Current Liabilities:

2

In: Accounting

Integrating problem—bonds, leases, taxes The long-term liabilities section of CPS Transportation’s December 31, 2015, balance sheet...

Integrating problem—bonds, leases, taxes

The long-term liabilities section of CPS Transportation’s December 31, 2015, balance sheet included the following:

a.  A lease liability with 15 remaining lease payments of $10,000 each, due annually on January 1:

Lease liability $76,061
    Less: Current portion     2,394
$73,667

The incremental borrowing rate at the inception of the lease was 11% and the lessor’s implicit rate, which was known by CPS Transportation, was 10%.

b.  A deferred income tax liability due to a single temporary difference. The only difference between CPS Transportation’s taxable income and pretax accounting income is depreciation on a machine acquired on January 1, 2015, for $500,000. The machine’s estimated useful life is five years, with no salvage value. Depreciation is computed using the straight-line method for financial reporting purposes and the MACRS method for tax purposes. Depreciation expense for tax and financial reporting purposes for 2016 through 2019 is as follows:

Year

MACRS

Depreciation

Straight-line

Depreciation

Difference
2016 $160,000 $100,000 $60,000
2017     80,000    100,000 (20,000)
2018     70,000    100,000 (30,000)
2019     60,000    100,000 (40,000)

The enacted federal income tax rates are 35% for 2015 and 40% for 2016 through 2019. For the year ended December 31, 2016, CPS’s income before income taxes was $900,000.

On July 1, 2016, CPS Transportation issued $800,000 of 9% bonds. The bonds mature in 20 years and interest is payable each January 1 and July 1. The bonds were issued at a price to yield the investors 10%. CPS records interest at the effective interest rate.

Required:

1.  Determine CPS Transportation’s income tax expense and net income for the year ended December 31, 2016.

2.  Determine CPS Transportation’s interest expense for the year ended December 31, 2016.

3.  Prepare the long-term liabilities section of CPS Transportation’s December 31, 2016, balance sheet.

In: Accounting

Problem 19-8 Net loss; stock dividend; nonconvertible preferred stock; treasury shares; shares sold; discontinued operations [LO19-5,...

Problem 19-8 Net loss; stock dividend; nonconvertible preferred stock; treasury shares; shares sold; discontinued operations [LO19-5, 19-6, 19-7, 19-13] On December 31, 2015, Ainsworth, Inc., had 640 million shares of common stock outstanding. Twenty seven million shares of 7%, $100 par value cumulative, nonconvertible preferred stock were sold on January 2, 2016. On April 30, 2016, Ainsworth purchased 30 million shares of its common stock as treasury stock. Twelve million treasury shares were sold on August 31. Ainsworth issued a 5% common stock dividend on June 12, 2016. No cash dividends were declared in 2016. For the year ended December 31, 2016, Ainsworth reported a net loss of $175 million, including an after-tax loss from discontinued operations of $470 million. Required: 1. Compute Ainsworth's net loss per share for the year ended December 31, 2016. (Round your intermediate calculations to 2 decimal places. Negative amounts should be indicated by a minus sign. Enter your answers in millions (i.e., 10,000,000 should be entered as 10).) 2. Compute the per share amount of income or loss from continuing operations for the year ended December 31, 2016. (Round your intermediate calculations to 2 decimal places. Enter your answers in millions (i.e., 10,000,000 should be entered as 10).) 3. Prepare an EPS presentation that would be appropriate to appear on Ainsworth's 2016 and 2015 comparative income statements. Assume EPS was reported in 2015 as $0.80, based on net income (no discontinued operations) of $512 million and a weighted-average number of common shares of 640 million. (Round your answers to 2 decimal places. Loss amounts should be indicated with a minus sign.)

In: Finance

The following selected transactions were taken from the books of Ripley Company for 2016:    1....

The following selected transactions were taken from the books of Ripley Company for 2016:

  

1.

On February 1, 2016, borrowed $58,000 cash from the local bank. The note had a 5 percent interest rate and was due on June 1, 2016.

2. Cash sales for the year amounted to $225,000 plus sales tax at the rate of 6 percent.
3.

Ripley provides a 90-day warranty on the merchandise sold. The warranty expense is estimated to be 2 percent of sales.

4. Paid the sales tax to the state sales tax agency on $190,000 of the sales.
5. Paid the note due on June 1 and the related interest.
6.

On November 1, 2016, borrowed $36,000 cash from the local bank. The note had a 7 percent interest rate and a one-year term to maturity.

7. Paid $3,100 in warranty repairs.
8.

A customer has filed a lawsuit against Ripley for $90,000 for breach of contract. The company attorney does not believe the suit has merit.

Required
a.

Answer the following questions:

1.

What amount of cash did Ripley pay for interest during 2016? (Round your answer nearest dollar amount.)

         

2.

What amount of interest expense is reported on Ripley’s income statement for 2016? (Round your answer nearest dollar amount.)

         

3. What is the amount of warranty expense for 2016?

         

b.

Post the liabilities transactions to T-accounts and prepare the current liabilities section of the balance sheet at December 31, 2016. (Round your answers nearest dollar amount.)

         

         

c.

Show the effect of these transactions on the financial statements using a horizontal statements model like the one shown here. Use + for increase, ? for decrease, and NA for not affected. In the Cash Flow column, indicate whether the item is an operating activity (OA), investing activity (IA), or financing activity (FA) or not affected (NA). The first transaction has been recorded as an example.

         

In: Accounting

Problem 2-44A Tombert Company is a manufacturer of computers. Its controller resigned in October 2016. An...

Problem 2-44A

Tombert Company is a manufacturer of computers. Its controller resigned in October 2016. An inexperienced assistant accountant has prepared the following income statement for the month of October 2016.

TOMBERT COMPANY
Income Statement
For the Month Ended October 31, 2016
Sales (net) $ 784,600
Less: Operating expenses
  Raw materials purchases $264,450
  Direct labour cost 190,900
  Advertising expense 89,300
  Selling and administrative salaries 74,450
  Rent on factory facilities 60,750
  Depreciation on sales equipment 44,700
  Depreciation on factory equipment 31,800
  Indirect labour cost 28,300
  Utilities expense 12,800
  Insurance expense 8,300 805,750
Net Loss $(21,150)


Prior to October 2016, the company had been profitable every month. The company’s president is concerned about the accuracy of the income statement. As his friend, he has asked you to review the income statement and make necessary corrections. After examining other manufacturing cost data, you have acquired the following additional information.

1. Inventory balances at the beginning and end of October were as follows:

October 1 October 31
Raw materials $17,500 $29,600
Work in process 16,500 14,500
Finished goods 30,900 45,700


2. Only 80% of the utilities expense and 51% of the insurance expense apply to factory operations. The remaining amounts should be charged to selling and administrative activities.

Calculate the following:

1. Prepare a schedule of the cost of goods manufactured for October 2016. (Round answers to 0 decimal places, e.g. 125.)

TOMBERT COMPANY
Cost of Goods Manufactured Schedule
For the Month Ended October 31, 2016

2.

Prepare a correct income statement for October 2016. (Round answers to 0 decimal places, e.g. 125. Enter negative amounts using either a negative sign preceding the number e.g. -45 or parentheses e.g. (45).)

TOMBERT COMPANY
Income Statement
For the Month Ended October 31, 2016

In: Accounting