Questions
WRITE IN C++ Add to the Coord class Edit the provided code in C++ Write a...

WRITE IN C++

Add to the Coord class

Edit the provided code in C++

Write a member function named

     int distance2origin()

that calculates the distance from the (x, y, z) point to the origin (0, 0, 0)

the ‘prototype’ in the class definition will be

     int distance2origin()

outside the class definition

            int Coord :: distance2origin()

{

                        // your code

}

_______________________________________________________________________________________________________

/**************************************************
*
*      program name:       Coord02
*      Author:             
*      date due:           10/19/20
*      remarks:
*
*
***************************************************/

/******************************************
*     library includes
******************************************/
#include            // needed for cin and cout

/******************************************
*     pre-processor
******************************************/
#define PI 3.14159
using namespace std;

class Coord {
private:
    int xCoord;
    int yCoord;
    int zCoord;

public:
    Coord(int xCoord, int yCoord, int zCoord){
        this->xCoord=xCoord;
        this->yCoord=yCoord;
        this->zCoord=zCoord;
    }

    inline void setXCoord(int xCoord){
        this->xCoord=xCoord;
    }
    inline void setYCoord(int yCoord){
        this->yCoord=yCoord;
    }
    inline void setZCood(int zCoord){
        this->zCoord=zCoord;
    }
    inline int getXCoord(){
        return this->xCoord;
    }
    inline int getYCoord(){
        return this-> yCoord;
    }
    inline int getZCoord(){
        return this->zCoord;
    }

    void display(){
        cout<xCoord<yCoord<zCoord<

Please Explain Everything in detail. Thank you.

In: Computer Science

“Triangle Guessing” game in Python The program accepts the lengths of three (3) sides of a...

Triangle Guessing” game in Python

The program accepts the lengths of three (3) sides of a triangle as input . The program output should indicate if the triangle is a right triangle, an acute triangle, or an obtuse triangle.

  1. Make sure each side of the triangle is a positive integer. Use try/except for none positive integer input.
  2. validating the triangle. That is the sum of the lengths of any two sides of a triangle is greater than the length of the third side. Use try/except for invalid sides input.
  3. For any wrong input, tell the player what is wrong and asking to re-enter.
  4. Allow a player to play multiple times, for example, using a while loop. Remind the player what input to stop the game.
  5. user friendly one.
  6. add comments:
    1. Introduce/describe the program including the author, date, goal/purpose of the program
    2. Document every variable used at the program even the name is meaningful
    3. Explain/comment operation/activity/logic of your code. For example, “Checking whether the inputs are positive integers” and “Checking the validity the 3 lengths to see if they are able to form a triangle”
  7. Testing your program for all possible input and every of the 3 possible triangles

In: Computer Science

i need to find complexity and cost and runtime for each line of the following c++...

i need to find complexity and cost and runtime for each line of the following c++ code :

// A C++ program for Dijkstra's single source shortest path algorithm.
// The program is for adjacency matrix representation of the graph

#include <limits.h>
#include <stdio.h>

// Number of vertices in the graph
#define V 9

// A utility function to find the vertex with minimum distance value, from
// the set of vertices not yet included in shortest path tree
int minDistance(int dist[], bool sptSet[])
{
   // Initialize min value
   int min = INT_MAX, min_index;

   for (int v = 0; v < V; v++)
       if (sptSet[v] == false && dist[v] <= min)
           min = dist[v], min_index = v;

   return min_index;
}

// A utility function to print the constructed distance array
void printSolution(int dist[])
{
   printf("Vertex \t\t Distance from Source\n");
   for (int i = 0; i < V; i++)
       printf("%d \t\t %d\n", i, dist[i]);
}

// Function that implements Dijkstra's single source shortest path algorithm
// for a graph represented using adjacency matrix representation
void dijkstra(int graph[V][V], int src)
{
   int dist[V]; // The output array. dist[i] will hold the shortest
   // distance from src to i

   bool sptSet[V]; // sptSet[i] will be true if vertex i is included in shortest
   // path tree or shortest distance from src to i is finalized

   // Initialize all distances as INFINITE and stpSet[] as false
   for (int i = 0; i < V; i++)
       dist[i] = INT_MAX, sptSet[i] = false;

   // Distance of source vertex from itself is always 0
   dist[src] = 0;

   // Find shortest path for all vertices
   for (int count = 0; count < V - 1; count++) {
       // Pick the minimum distance vertex from the set of vertices not
       // yet processed. u is always equal to src in the first iteration.
       int u = minDistance(dist, sptSet);

       // Mark the picked vertex as processed
       sptSet[u] = true;

       // Update dist value of the adjacent vertices of the picked vertex.
       for (int v = 0; v < V; v++)

           // Update dist[v] only if is not in sptSet, there is an edge from
           // u to v, and total weight of path from src to v through u is
           // smaller than current value of dist[v]
           if (!sptSet[v] && graph[u][v] && dist[u] != INT_MAX
               && dist[u] + graph[u][v] < dist[v])
               dist[v] = dist[u] + graph[u][v];
   }

   // print the constructed distance array
   printSolution(dist);
}



In: Computer Science

An ecologist observes an alarming number of frogs in agricultural areas that have extra limbs. She...

An ecologist observes an alarming number of frogs in agricultural areas that have extra limbs. She hypothesizes that the presence of Round-Up causes frogs to grow extra limbs (this is a real effect of Round-Up!).

She puts 25 tadpoles in an aquarium with pure water and labels these Group A.

She puts another 25 tadpoles in an aquarium with water and Round-Up and labels these Group B.

After all of the tadpoles develop into adult frogs, she counts the number of frogs in each group that have extra limbs.

1. Write a prediction for this hypothesis and experiment.

2. Identify the independent variable and dependent variable.

3. Identify the experimental group and the control group.

4. Name a variable she needs to control for in order to obtain reliable results.

In: Biology

66. You are deciding on a drug treatment for a patient with pancreatic cancer. You know...

66. You are deciding on a drug treatment for a patient with pancreatic cancer. You know that different drugs have different efficacies based on the nature of the specific type of tumor. You decide to identify the tumor type by transcriptional analysis.  What experiment would you do to perform this analysis?Your analysis shows upregulation of a cluster of cell cycle genes, glucose metabolism genes and receptor tyrosine kinase signaling genes.  Why do you suppose these 3 sets of genes would be upregulated? You decide to target the tyrosine kinase receptor signaling gene products for drug treatment.  Name 2 protein targets and whether the drug would increase or decrease the targets activity.

This is how the question ask!!!!!!!!!!!!

In: Biology

Comprehensive Problem 2-2A Ray and Maria Gomez have been married for 3 years. They live at...

Comprehensive Problem 2-2A

Ray and Maria Gomez have been married for 3 years. They live at 1610 Quince Ave., McAllen, TX 78701. Ray is a propane salesman for Palm Oil Corporation and Maria works as a city clerk for the City of McAllen. Maria's Social Security number is 444-65-9912 and Ray’s is 469-21-5523. Ray’s birthdate is February 21, 1988 and Marie’s is December 30, 1990. Ray and Maria’s earnings are reported on the following Form W-2s:

a Employee's social security number
469-21-5523
OMB No. 1545-0008 Safe, accurate,
FAST! Use
IRS e ~ file Visit the IRS website at
www.irs.gov/efile
b Employer identification number (EIN)
21-7654321
1 Wages, tips, other compensation
30,129.00
2 Federal income tax withheld
4,120.00
c Employer's name, address, and ZIP code
Palm Oil Corp.
11134 E. Pecan Blvd.
McAllen, TX 78501
3 Social security wages
30,129.00
4 Social security tax withheld
1,868.00
5 Medicare wages and tips
30,129.00
6 Medicare tax withheld
436.87
7 Social security tips

8 Allocated tips
d Control number 9 10 Dependent care benefits
e Employee's first name and initial
Ray Gomez
1610 Quince Avenue
McAllen, TX 78701
Last name Suff. 11 Nonqualified plans 12a See instructions for box 12
C
o
d
e
13
Statutory employee Retirement plan Third-party sick pay
12b
C
o
d
e
14 Other 12c
C
o
d
e
12d
C
o
d
e
f Employee's address and ZIP code
15State

TX
Employer's state ID number 16 State wages, tips, etc. 17 State income tax 18 Local wages, tips, etc. 19 Local income tax 20 Locality name
Form W-2 Wage and Tax
Statement
2016
Department of the Treasury—Internal Revenue Service
Copy B–To Be Filed With Employee's FEDERAL Tax Return.
This information is being furnished to the Internal Revenue Service.
a Employee's social security number
444-65-9912
OMB No. 1545-0008 Safe, accurate,
FAST! Use
IRS e ~ file Visit the IRS website at
www.irs.gov/efile
b Employer identification number (EIN)
23-4444321
1 Wages, tips, other compensation
32,245.00
2 Federal income tax withheld
5,020.00
c Employer's name, address, and ZIP code
City of McAllen
1300 W. Houston Ave.
McAllen, TX 78501
3 Social security wages
32,245.00
4 Social security tax withheld
1,999.19
5 Medicare wages and tips
32,245.00
6 Medicare tax withheld
467.55
7 Social security tips

8 Allocated tips
d Control number 9 10 Dependent care benefits
e Employee's first name and initial
Maria Gomez
1610 Quince Avenue
McAllen, TX 78701
Last name Suff. 11 Nonqualified plans 12a See instructions for box 12
C
o
d
e
13
Statutory employee Retirement plan Third-party sick pay
12b
C
o
d
e
14 Other 12c
C
o
d
e
12d
C
o
d
e
f Employee's address and ZIP code
15State

TX
Employer's state ID number 16 State wages, tips, etc. 17 State income tax 18 Local wages, tips, etc. 19 Local income tax 20 Locality name
Form W-2 Wage and Tax
Statement
2016
Department of the Treasury—Internal Revenue Service
Copy B–To Be Filed With Employee's FEDERAL Tax Return.
This information is being furnished to the Internal Revenue Service.

Ray and Maria have interest income of $641 from a savings account at McAllen State Bank. In addition, they own U.S. Savings bonds (Series EE). The bonds had a value of $10,000 on January 1, 2016, and their value is $10,700 on December 31, 2016. They have not made an election with respect to these bonds.

Ray has an ex-wife named Judy Gomez. Pursuant to their divorce decree, Ray pays her $455 per month in alimony. All payments were made on time in 2016. Judy's Social Security number is 566-74-8765.

During 2016, Ray was in the hospital for a successful operation. His health insurance company reimbursed Ray $4,732 for all of his hospital and doctor bills.

In June 2016, Maria's father died. Under a life insurance policy owned and paid for by her father, Maria was paid death benefits of $25,000.

Maria bought a Texas lottery ticket on impulse during 2016. Her ticket was lucky and she won $3,900. The winning amount was paid to Maria in November 2016, with no income tax withheld.

Palm Oil Corporation provide Ray with a company car to drive while he is working. The Corporation spent $5,000 to maintain this vehicle during 2016. Ray never uses the car for personal purposes.

Required:

Complete the Gomez's federal tax return for 2016. Use Form 1040 below. Make realistic assumptions about any missing data. If an amount box does not require an entry or the amount is zero, enter "0".

Click here to access the tax table to use for this problem.

Form 1040 Department of the Treasury—Internal Revenue Service (99)
U.S. Individual Income Tax Return

2016

OMB No. 1545-0074

IRS Use Only
For the year Jan. 1–Dec. 31, 2016, or other tax year beginning , 2016, ending , 20
See separate instructions.
Your first name and initial
Ray
Last name
Gomez
Your social security number
469-21-5523
If a joint return, spouse's first name and initial
Maria
Last name
Gomez
Spouse's social security number
444-65-9912
Home address (number and street). If you have a P.O. box, see instructions.
1610 Quince Avenue
Apt. no. ▲ Make sure the SSN(s) above and on line 6c are correct.
City, town or post office, state, and ZIP code. If you have a foreign address, also complete spaces below (see instructions).
Mc Allen, TX 78701

Presidential Election Campaign

Check here if you, or your spouse if filing jointly, want $3 to go to this fund. Checking a box below will not change your tax or refund.

You    ☑Spouse

Foreign country name
Foreign province/state/country
Foreign postal code
Filing status
Exemptions 6a Yourself. If someone can claim you as a dependent, do not check box 6a . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . } Boxes checked on 6a and 6b
b Spouse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

If more than
four dependents,
see instructions and check here. ► ▢
c Dependents:
(2)Dependent's social security number

(3)Dependent's relationship to you
(4) ✔ If child under age 17 qualifying for child tax credit (see instructions) No. of children on 6c who:
• lived with you




________
(1) First name Last name

• did not live with you due to divorce or separation (see instructions)





________


Dependents on 6c not entered above


________




d



Total number of exemptions claimed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Add numbers on lines above ►

Income

Attach
Form(s) W-2
here. Also
attach
Forms
W-2G and
1099-R if
tax was
withheld.


If you did not
get a W-2, see
instructions.
7 Wages, salaries, tips, etc. Attach Form(s) W-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
8a Taxable interest. Attach Schedule B if required . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8a
b Tax-exempt interest. Do not include on line 8a . . . . . . . . . 8b
9a Ordinary dividends. Attach Schedule B if required . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9a
b Qualified dividends . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . 9b
10 Taxable refunds, credits, or offsets of state and local income taxes . . . . . . . . . . . . . . . . 10
11 Alimony received . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
12 Business income or (loss). Attach Schedule C or C-EZ . . . . . . . . . . . . . . . . . .. . . . . . . . 12
13 Capital gain or (loss). Attach Schedule D if required. If not required, check here ► ▢ 13
14 Other gains or (losses). Attach Form 4797 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
15a IRA distributions . . . . . . . . . . . 15a b Taxable amount . . . . 15b
16a Pensions and annuities . . . . . . 16a b Taxable amount . . . . 16b
17 Rental real estate, royalties, partnerships, S corporations, trusts, etc. Attach Schedule E 17
18 Farm income or (loss). Attach Schedule F . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
19 Unemployment compensation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
20a Social security benefits . . . . . . 20a b Taxable amount . . . . 20b
21
Other income. List type and amount
21
22 Combine the amounts in the far right column for lines 7 through 21. This is your total income ► . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Adjusted
Gross
Income
23 Educator expenses . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
24 Certain business expenses of reservists, performing artists, and fee-basis government officials. Attach Form 2106 or 2106-EZ 24
25 Health savings account deduction. Attach Form 8889 . . . . . 25
26 Moving expenses. Attach Form 3903 . . . . . . . . . . . . . . . . . . 26
27 Deductible part of self-employment tax. Attach Schedule SE 27
28 Self-employed SEP, SIMPLE, and qualified plans . . . . . . . . . 28
29 Self-employed health insurance deduction . . . . . . . . . . . . . 29
30 Penalty on early withdrawal of savings . . . . . . . . . . . . . . . . 30
31a Alimony paid   b Recipient's SSN ► 31a
32 IRA deduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
33 Student loan interest deduction . . . . . . . . . . . . . . . . . . . . . 33
34 Tuition and fees. Attach Form 8917 . . . . . . . . . . . . . . . . . 34
35 Domestic production activities deduction. Attach Form 8903 35
36 Add lines 23 through 35 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
37 Subtract line 36 from line 22. This is your adjusted gross income . . . . . . . . . . . . . . 37
For Disclosure, Privacy Act, and Paperwork Reduction Act Notice, see separate instructions. Cat. No. 11320B Form 1040 (2016)


Form 1040 (2016) Page 2
38 Amount from line 37 (adjusted gross income) 38
Tax and
Credits
39a
Check
if:
{ You were born before January 2, 1952, ▢ Blind.
Spouse was born before January 2, 1952, ▢ Blind.
} Total boxes
checked ► 39a
Standard Deduction for

• People who check any box on line 39a or 39b or who can be claimed as a dependent, see instructions.

• All others:

Single or Married filing separately, $6,300

Married filing jointly or Qualifying widow(er), $12,600

Head of household, $9,300

b If your spouse itemizes on a separate return or you were a dual-status alien, check here ► 39b ▢ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
40 Itemized deductions (from Schedule A) or your standard deduction (see left margin) 40
41 Subtract line 40 from line 38 . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
42 Exemptions. If line 38 is $155,650 or less, multiply $4,050 by the number on line 6d. Otherwise, see instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
43 Taxable income. Subtract line 42 from line 41. If line 42 is more than line 41, enter -0- 43
44 Tax (see instructions). Check if any from: a ▢ Form(s) 8814 b ▢ Form 4972 c ▢ ___ 44
45 Alternative minimum tax (see instructions). Attach Form 6251 . . . . . . . . . . . . . . . . 45
46 Excess advance premium tax credit repayment. Attach Form 8962 . . . . . . . . . . . . .. . . 46
47 Add lines 44, 45, and 46 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
48 Foreign tax credit. Attach Form 1116 if required . . . . . . . . . . . . . 48
49 Credit for child and dependent care expenses. Attach Form 2441 49
50 Education credits from Form 8863, line 19 . . . . . . . . . . . . . . . . . . 50
51 Retirement savings contributions credit. Attach Form 8880 . . . . . 51
52 Child tax credit. Attach Schedule 8812, if required . . . . . . . . . . . . 52
53 Residential energy credits. Attach Form 5695 . . . . . . . . . . . . . . . . 53
54
Other credits from Form: a ▢ 3800 b ▢ 8801 c
54
55 Add lines 48 through 54. These are your total credits . .. . . . . . . . . . . . . . . . . . . . . . . . . 55
56 Subtract line 55 from line 47. If line 55 is more than line 47, enter -0- . . . . . . . . . . . . . . 56
Other
Taxes
57 Self-employment tax. Attach Schedule SE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
58 Unreported social security and Medicare tax from Form: a ▢ 4137 b ▢ 8919 . . . . . . . . . 58
59 Additional tax on IRAs, other qualified retirement plans, etc. Attach Form 5329 if required 59
60a Household employment taxes from Schedule H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60a
b First-time homebuyer credit repayment. Attach Form 5405 if required . . . . . . . . . . . . . . . 60b
61 Health care: individual responsibility (see instructions) Full-year coverage 61
62 Taxes from: a ▢ Form 8959 b ▢ Form 8960 c ▢ Instructions; enter code(s) _ _ _ _ _ _ _ 62
63 Add lines 56 through 62. This is your total tax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Payments 64 Federal income tax withheld from Forms W-2 and 1099 . . . . . . . . . 64
If you have a qualifying child, attach Schedule EIC. 65 2016 estimated tax payments and amount applied from 2015 return 65
66a Earned income credit (EIC) . . . . . . . . . . . . . . . . . . . . . .. . . . 66a
b Nontaxable combat pay election . . . . . . . 66b
67 Additional child tax credit. Attach Schedule 8812 . . . . . . . . . . . . . . 67
68 American opportunity credit from Form 8863, line 8 . . . . . . . . . . . . 68
69 Net premium tax credit. Attach Form 8962 . . . . . . . . . . . . . . . . 69
70 Amount paid with request for extension to file . . . . . . . . . . . . . . . . 70
71 Excess social security and tier 1 RRTA tax withheld . . . . . . . . . . . . 71
72 Credit for federal tax on fuels. Attach Form 4136 . . . . . . . . . . . . . . 72
73
Credits from Form:  a ▢ 2439   b ▢ Reserved   c ▢ 8885   d
73
74 Add lines 64, 65, 66a, and 67 through 73. These are your total payments . . . . . . . .. . 74
Refund 75 If line 74 is more than line 63, subtract line 63 from line 74. This is the amount you overpaid 75
76a Amount of line 75 you want refunded to you. If Form 8888 is attached, check here . . ► 76a
Direct deposit? See instructions. b
Routing number c Type:  ▢ Checking  ▢ Savings
d
Account number
77 Amount of line 75 you want applied to your 2017 estimated tax 77
Amount
You Owe
78 Amount you owe. Subtract line 74 from line 63. For details on how to pay, see instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
79 Estimated tax penalty (see instructions) . . . . . . . . . . . . . . . .. . 79
Third Party Designee Do you want to allow another person to discuss this return with the IRS (see instructions)? ▢ Yes. Complete below. ▢ No
Designee's
name

Phone
no.

Personal identification
number (PIN) ►
Sign
Here

Joint return? See instructions. Keep a copy for your records.
Under penalties of perjury, I declare that I have examined this return and accompanying schedules and statements, and to the best of my knowledge and belief, they are true, correct, and complete. Declaration of preparer (other than taxpayer) is based on all information of which preparer has any knowledge.
Your signature
Ray Gomez
Date Your occupation
Salesman
Daytime phone number
Spouse's signature. If a joint return, bothmust sign.
Maria Gomez
Date Spouse's occupation
Clerk
If the IRS sent you an Identity Protection PIN, enter it here (see inst.)
Paid Preparer Use Only Print/Type preparer's name Preparer's signature Date Check ▢ if self-employed PTIN
Firm's name Firm's EIN ►
Firm's address ► Phone no.
www.irs.gov/form1040 Form 1040 (2016)

In: Accounting

Show clearly, with calculation steps, how to make 200ml of 90% and 80%(v/v) ethanol, respectively. Show...

  1. Show clearly, with calculation steps, how to make 200ml of 90% and 80%(v/v) ethanol, respectively.
  2. Show clearly, with calculation steps, how to make 70% (v/v) ethanol + 1% (v/v) acetic acid (final volume = 200ml).

In: Other

Mass M moves to the right with speed =v along a frictionless horizontal surface and crashes...

Mass M moves to the right with speed =v along a frictionless horizontal surface and crashes into an equal mass M initially at rest. Upon colliding, the two masses stick together and move with speed V to the right. Notice that v and V denote different speeds.  After the collision the magnitude of the momentum of the system is:

(pick all correct answers)

2 M V

M V

0

2 M v

M v

In: Physics

Objectives: • Learn to write test cases with Junit • Learn to debug code Problem: Sorting...

Objectives:

Learn to write test cases with Junit

Learn to debug code

Problem: Sorting Book Objects

Download the provided zipped folder from Canvas. The source java files and test cases are in

the provided

folder. The Book class models a book. A Book has a unique id, title, and author.

The BookStore class stores book objects in a List, internally stored as an ArrayList. Also, the

following methods are implemented for the BookStore class.

addBook(Book b):

sto

res the book in the book list.

getBookSortedByAuthor():

returns a book list sorted by author name descending

alphabetically.

getBooksSortedByTitle():

returns a book listed sorted by title descending alphabetically.

getBooks():

returns the current book list

.

deleteBook(Book b5):

removes the given book from the book list.

countBookWithTitle(String title):

iterates through the book list counting the number of

books with the given title. Returns the count of books with the same title.

Write test cases to test t

he implementation.

The test case method stubs have been created.

Fill out the method stubs. After filling in the test case method stubs, run BookStoreTest to test

the BookStore.java code. Find and fix bugs in the BookStore.java code by using the debugger o

n

the test case method stubs.

Grade:

For this lab, we will need to see either

1)

Fully functional code solving the problem as specified or

Book.java


public class Book {

   private int id; // the unique id assigned to book
   private String title; // book title
   private String authorName;// author of the book

   public Book() {
       super();
   }

   public Book(int id, String authorName, String title) {
       this.id = id;
       this.title = title;
       this.authorName = authorName;
   }

   public int getId() {
       return id;
   }

   public void setId(int id) {
       this.id = id;
   }

   public String getTitle() {
       return title;
   }

   public void setTitle(String title) {
       this.title = title;
   }

   public String getAuthorName() {
       return authorName;
   }

   public void setAuthorName(String authorName) {
       this.authorName = authorName;
   }

   @Override
   public String toString() {
       return "\n Book [id=" + id + ", title=" + title + ", authorName="
               + authorName + "]";
   }

}

BookStore.java


import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

public class BookStore {

   private List<Book> books; // store books in a list

   public BookStore() {
       books = new ArrayList<Book>();

   }

   public void addBook(Book b1) {
       books.add(b1);

   }

   public List<Book> getBooksSortedByAuthor() {
       List<Book> temp = new ArrayList<Book>(books);
       Collections.sort(temp, new Comparator<Book>() {
           public int compare(Book b1, Book b2) {
               return b1.getTitle().compareTo(b2.getAuthorName());
           }
       });
       return books;
   }

   public int countBookWithTitle(String title) {
       int count = 2;
       for (Book book : books) {
           if (book.getTitle() == title) {
               count++;
           }
       }
       return count;
   }

   public void deleteBook(Book b5) {
       books.remove(b5);
   }

   public List<Book> getBooks() {
       return books;
   }

   public List<Book> getBooksSortedByTitle() {
       List<Book> temp = new ArrayList<Book>(books);
       Collections.sort(temp, new Comparator<Book>() {
           public int compare(Book b1, Book b2) {
               return b1.getTitle().compareTo(b2.getAuthorName());
           }
       });
       return temp;
   }

}

BookStoreTest.java


import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;

public class BookStoreTest {

   private BookStore store;
   private Book b1 = new Book(1, "Harper Lee", "To Kill a Mockingbird");
   private Book b2 = new Book(2, "Harper Lee", "To Kill a Mockingbird");
   private Book b3 = new Book(3, "Frances Hodgson", "The Secret Garden");
   private Book b4 = new Book(5, "J.K. Rowling",
           "Harry Potter and the Sorcerer's Stone");
   private Book b5 = new Book(4, "Douglas Adams",
           "The Hitchhiker's Guide to the Galaxy");

   /**
   * setup the store
   *
   */
   @Before
   public void setUpBookStore() {
       store = new BookStore();
       store.addBook(b1);
       store.addBook(b2);
       store.addBook(b3);
       store.addBook(b4);

   }

   /**
   * tests the addition of book
   *
   */

   @Test
   public void testAddBook() {
       store.addBook(b1);
       assertTrue(store.getBooks().contains(b1));

   }

   /**
   * tests the deletion of book
   *
   */

   @Test
   public void testDeleteBook() {

   }

   /**
   * tests sorting of books by author name
   *
   */

   @Test
   public void testGetBooksSortedByAuthor() {

   }

   /**
   * tests sorting of books by title
   *
   */

   @Test
   public void testGetBooksSortedByTitle() {

   }

   /**
   * tests the number of copies of book in store
   *
   */

   @Test
   public void testCountBookWithTitle() {

   }

}

In: Computer Science

Which of the following is notone of the main features of Beethoven’s “symphonic ideal” as evidenced...

  1. Which of the following is notone of the main features of Beethoven’s “symphonic ideal” as evidenced in his Fifth Symphony?
    1. Motivic drive
    2. Rhythmic consistency
    3. Psychological progression
    4. Strict adherence to form and classical musical ideals
  1. Which of the following statements about Beethoven is false?
    1. Beethoven’s music enjoyed wild popularity during his lifetime but then was largely forgotten until the 20thcentury.
    2. Beethoven’s work bridges the Classical and Romantic styles.
    3. For many, Beethoven’s works represent the ideal artist who strove to create works that showed personal elements as well as trying to elevate art in society.
    4. Beethoven lived and worked in a time when musicians and their music was being taken more seriously than ever before.

In: Computer Science