Questions
/* * Assignment: #3 * Topic: Identifying Triangles * Author: <YOUR NAME> */ package edu.depaul.triangle; import...

/* 
 * Assignment: #3
 * Topic: Identifying Triangles
 * Author: <YOUR NAME>
 */

package edu.depaul.triangle;

import static edu.depaul.triangle.TriangleType.EQUILATERAL;
import static edu.depaul.triangle.TriangleType.ISOSCELES;
import static edu.depaul.triangle.TriangleType.SCALENE;

import java.util.Scanner;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * A class to classify a set of side lengths as one of the 3 types
 * of triangle: equilateral, isosceles, or scalene.
 *
 * You should not be able to create an invalid Triangle.  The
 * constructor throws an IllegalArgumentException if the input
 * cannot be interpreted as a triangle for any reason.
 */
public class Triangle {

  private static final Logger logger = LoggerFactory.getLogger(Triangle.class);
  private int[] sides = new int[3];
  
  /**
   * Define as private so that it is not a valid
   * choice.
   */
  private Triangle() {}
  
  public Triangle(String[] args) {
    validateArgs(args);

    parseArgs(args);

    validateLength();
  }

  public TriangleType classify() {
    TriangleType result;
    if ((sides[0] == sides[1]) && (sides[1] == sides[2])) {
      result = EQUILATERAL;
    } else if ((sides[0] == sides[1])
        || (sides[1] == sides[2])) {
      result = ISOSCELES;
    } else {
      result = SCALENE;
    }
    logger.debug("classified as: " + result);
    return result;
  }

  private void parseArgs(String[] args) {
    // throws IllegalArgumentException on a failed parse
    for (int i = 0; i < args.length; i++) {
      sides[i] = Integer.parseInt(args[i]);
    }
  }

  private void validateArgs(String[] args) {
    if ((args == null) || (args.length != 3)) {
      throw new IllegalArgumentException("Must have 3 elements");
    }
  }

  private void validateLength() {
    for (int i = 0; i < sides.length; i++) {
      if (sides[i] > 400) {
        throw new IllegalArgumentException("max size is 400");
      }
    }
  }
  
}
/*
 * Assignment: #3
 * Topic: Identifying Triangles
 * Author: <YOUR NAME>
 */
package edu.depaul.triangle;

import static org.junit.jupiter.api.Assertions.*;
import static edu.depaul.triangle.TriangleType.ISOSCELES;
import static edu.depaul.triangle.TriangleType.EQUILATERAL;
import static edu.depaul.triangle.TriangleType.SCALENE;

import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;

public class TriangleTest {

  @Test
  @DisplayName("Remove me and add proper tests")
  void testPlaceHolder() {

  }
}

Need to write tests to see if the program works correctly. (using assert)

In: Computer Science

Book SerialNum : String - Name: String – Author : String PublishYear: int - Edition:int Status...

Book

SerialNum : String -

Name: String –

  • Author : String

PublishYear: int -

  • Edition:int
  • Status : boolean

+ Book()

Book(String, String, String, int , int)+

+ setName(String) : void

+ setSerialNum(String) : void

+ setAuthor(String) : void

+ setEdition(int) : void

+ setYear(int) : void

+ getName():String

+ getAuthor():String

+ getYear(): int

+ getSerialNum(): String

+ getEdition():int

+ setAvailable() : void

+ setUnavailable(): void

checkAvailability(): boolean

-----------------------------------------------------------------------------------

Library

Name : String

Address: String

Static NUMBEROFBOOKS: int

BooksAtLibrray : ArrayList

LibraryIssues: TreeMap

Library()

Library(String, String)

addBook(Book): void

removeBook(Book) : Boolean

searchBookByName(Book) : Boolean

searchBookBySerialNumber(Book) : Boolean

checkBookAvailablity(Book): Boolean

createLibraryIssue(LibrrayIssue):Boolean

addLibraryIssue(LibraryIssue)

removeLibrrayIssue(LibrrayIssue):Boolean

searchLibrrayIssueByStuent(Student): List

searchLibraryIssuebyID(String IssueID):LibrrayIssue

searchLibraryIssueByBook(Book): LibraryIssue

--------------------------------------------------------------------------------------------------------------

Student

id : String

Name: String

Age : int

Student()

Student(String, String, int)

setName (String):void

SetAge(int):void

setId(String):void

getID():String

getName():String

getAge():int

---------------------------------------------------------------------------------------------------

LibraryIsuue

IssueID : String

borrower : Student

borrowedBook : Book

LibraryIssue()

LibraryIssue(String, Student , Book)

setIssueId(String):void

setBorrower(Student):void

setBorrowedBook(Book):void

getIssueID():String

getBorrowed():Student

getBorrowedBook():Book

----------------------------------------------------------------------------------------------------------

Librray

Main()

-----------------------------------------------------------------------------------------------------------------------------------------

Use the attached UML diagrams to build up your project classes

Make sure to put view for your project by Entering true data

You will need to add 5 books and 5 students and at least 3 LibraryIssues

LibraryIssues keeps track of the borrowed book

The librray uses all classes as mentioned in the UML diagram

You will need to check if book is available before borrowing it.

searchLibrrayIssueByStuent(Student): List

This method returns all book if borrowed by single student, as a student could borrow more than one book

Static NUMBEROFBOOKS: int

Each time you add a book the static variable is increased  and Each time a book is removed so the static variable is decreased.

createLibraryIssue(LibraryIssue) : boolean

changed the Boolean variable status in book element to false and return false if book is not available

removeLibrrayIssue(LibraryIssue):Boolean

changed the Boolean variable status in book element to true and return false if book is available

Note

LibrrayIssue and Book in the class Library should be List or map

Do not use array as the size is not fixed

In: Computer Science

Liza dela Cruz is a plain housewife with maid. Her height is 5'4inches. Compute for her...

Liza dela Cruz is a plain housewife with maid. Her height is 5'4inches.

Compute for her

a. DBW

b. TER

c. FEL

d. Diet Planning

In: Nursing

Structurally deficient highway bridges. Data on structurally deficient highway bridges is compiled by the Federal Highway...

Structurally deficient highway bridges. Data on structurally deficient highway bridges is compiled by the Federal Highway Administration (FHWA) and reported in the National Bridge Inventory (NBI). For each state, the NBI lists the number of structurally deficient bridges and the total area (thousands of square feet) of the deficient bridges. The data for the 50 states (plus the District of Columbia and Puerto Rico). For future planning and budgeting, the FHWA wants to estimate the total area of structurally deficient bridges in a state based on the number of deficient bridges

NumberSD

SDArea

1899

432.71

155

60.92

181

110.57

997

347.35

3140

5177.97

580

316.92

358

387.78

20

9.05

24

59.34

302

412.92

1028

344.86

142

39.8

349

135.43

2501

1192.43

2030

688.19

5153

1069.71

2991

527.47

1362

458.37

1780

1453.26

349

131.13

388

236.18

585

521.83

1584

804.15

1156

325.9

3002

692.75

4433

1187.42

473

90.94

2382

335.75

47

20.08

383

127.66

750

752.43

404

196.67

2128

1427.73

2272

1034.61

743

101.42

2862

965.16

5793

1423.25

514

393.96

5802

2404.61

164

237.96

1260

626.38

1216

209.33

1325

481.31

2186

1031.45

233

102.56

500

153.8

1208

483.68

400

502.03

1058

331.59

1302

399.8

389

143.46

241

195.43

a) Deplaned on scatterplot, can you use linear regression to predict SDArea based onNumberSD? Explain.

b) Develop a simple linear regression equation to predict SDArea based on NumberSD.

c) Is the model you found in (a) a good fit? Why or why not?

d) Predict the SDArea when the NumberSD is 1260 bridges. Find the corresponding residuals.

e) Build a 90% CI, confidence interval, for coefficient of NumberSD ( b1).

f) Repeat (e) with a 95% CI. What is the difference between your answer in (e) and (f)?

In: Statistics and Probability

Describe elastic, inelastic, and completely inelastic collisions. Which type of collisions are you going to investigate...

Describe elastic, inelastic, and completely inelastic collisions. Which type of collisions are you going to investigate in the lab?

Do you expect the linear momentum of the system to be conserved in your experiment?In which part? Explain why.

Do you expect kinetic energy of the system to be conserved in your experiment? In which part? Explain why.

In one trial for inelastic collisions in the experiment, cart 1 has mass m1 and is initially moving with velocity v ⃗_1i to the right. Cart 2 with mass m2 is initially moving with velocity v ⃗_2i also to the right. The velocity of the cart 1 is larger than the velocity of cart 2 causing a collision between both carts. After the collision, the carts stick together and move with velocity v ⃗_f to the right.

Write down the expression for the magnitude of linear momentum of the system before collision.

Write down the expression for the magnitude of linear momentum of the system after the collision.

Write down the expression for the magnitude of kinetic energy of the system before collision.

Write down the expression for the magnitude of the kinetic energy of the system after the collision.

In: Physics

Which demographic variables were assessed by the author for this study? (Select all that apply.) Research...

Which demographic variables were assessed by the author for this study? (Select all that apply.)

Research Article Critique, Part One

Illness Representations, Treatment Beliefs, Medication Adherence, and 30-day Hospital Readmission Rates in Adults with Chronic Heart Failure.

(Turrise, 2016)

A.age

B. socioeconomic status

c.zip code

D.education level

E.work status

F .number of children

In: Nursing

Introduction Write in C++ at the Linux command line a program that is the same as...

Introduction

Write in C++ at the Linux command line a program that is the same as the previous collection app project but now uses a class to store the items and also can save the items to a file that can be read back into the array by the user when the program is re-started.

You can use your project 1 submission as a starting point or you can do something new as long as it meets the listed requirements.

Again, try and keep it reasonably simple to do by the due date but still meets the requirements listed below. You will be graded mainly on how well you follow the listed requirements.

REQUIREMENTS

PLEASE SEE THE GENERAL REQUIREMENTS FOR FURTHER REQUIREMENTS NEEDED. BELOW IS NOT ALL THE REQUIREMENTS NEEDED IN YOUR CODE.

Your program should have as a minimum the following tasks:

a. Allow the user to add entries to the collection. Check for valid data and let the user re-enter if they enter invalid data. Please let the user know what is valid data. Remember that user input should NOT cause your program to malfunction or crash.

b. Allow the user to print out the entire collection. Should not print out blank entries or invalid entries.

c. Allow the user to delete an entry from the collection. Allow users to

choose which entry to delete. If the entry is not found, do print out an error message, don't just do nothing. You can ask the user to re-enter or you can just return to the main function.

d. Allow the user to read in items from a file. Ask the user for a file name, open the file and read in the items from the file into the array. f there are already items in the collection, append to the end of the array. If the file doesn't exist, print out an error message and return the main loop.

e. Allow the user to write out items to a file. Ask the user for a file name (if the file exists; just overwrite the file). The information should be written in a format that can be read back into the program when the user wants to read in the file. Basically, while grading your program I plan to create some items, write the items out to a file, exit the program, re-start the program, then read back in the items. If your program can't do this correctly, you will get points off.

Other tasks can be added but only if the above tasks are also present and working correctly. Extra tasks will be graded for completeness and correctness so make sure they work too.

The program also needs to have the following code structures:

a) An array of objects. The class needs at least 3 member variables. At least one member variable should be numeric (integer or floating point) and at least one member variable should be a string type (C-Strings or the builtin string class). Note that this class is for ONE and only ONE item in the list; don't store a list of items in this class.

b) The code for the class should be in two separate files: A header file (.h) and an implementation file (.cpp). These are in addition to the main.cpp file so in all you need to turn in at least three code files.

c) Member variables must be declared private. Only member functions can be declared public.

d) Must have a 'setter' and a 'getter' for each member variable. You can have other member functions in the class as long as they are doing something with the member variables for one item.

e) Must have at least a default constructor. You can have other parameterized constructors but at least the default one should be there. Initialize strings to an empty string and numbers to zero.


+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


Example Output Runs
Here are 4 runs. Note that any files written out can be read back in when running the program again. Also, reading in will append to the end of the array.
----------------------
RUN 1
----------------------
*** BOOK COLLECTION ***
== Main Menu ==
1 -> read in books from a file
2 -> write out books to a file
3 -> add books to the collection
4 -> print all books
5 -> delete a book from the collection
6 -> quit the program
Please enter a choice (1 to 6)
4
no books in collection
== Main Menu ==
1 -> read in books from a file
2 -> write out books to a file
3 -> add books to the collection
4 -> print all books
5 -> delete a book from the collection
6 -> quit the program
Please enter a choice (1 to 6)
1
Enter file name? books.txt
== Main Menu ==
1 -> read in books from a file
2 -> write out books to a file
3 -> add books to the collection
4 -> print all books
5 -> delete a book from the collection
6 -> quit the program
Please enter a choice (1 to 6)
4
---- 0 ----
title: The Name Of The Wind
author: Patrick Roth
year: 2007
---- 1 ----
title: Lord Of The Rings: The Fellowship of the Ring
author: J. R. R. Tolkien
year: 1954
---- 2 ----
title: Mistborn
author: Brandon Sanderson
year: 2006
---- 3 ----
title: A Game Of Thrones
author: George R. R. Martin
year: 1996
---- 4 ----
title: Harry Potter And The Sorcerer's Stone
author: J.K. Rowling
year: 1997
---- 5 ----
title: A Wizard of Earthsea
author: Ursula K. Leguin
year: 1968
== Main Menu ==
1 -> read in books from a file
2 -> write out books to a file
3 -> add books to the collection
4 -> print all books
5 -> delete a book from the collection
6 -> quit the program
Please enter a choice (1 to 6)
3
enter title?
The Way of Kings
enter author?
Brandon Sanderson
enter year? (year should be larger than 0)
2011
Do you want to continue? ('y' or 'n')
n
== Main Menu ==
1 -> read in books from a file
2 -> write out books to a file
3 -> add books to the collection
4 -> print all books
5 -> delete a book from the collection
6 -> quit the program
Please enter a choice (1 to 6)
4
---- 0 ----
title: The Name Of The Wind
author: Patrick Roth
year: 2007
---- 1 ----
title: Lord Of The Rings: The Fellowship of the Ring
author: J. R. R. Tolkien
year: 1954
---- 2 ----
title: Mistborn
author: Brandon Sanderson
year: 2006
---- 3 ----
title: A Game Of Thrones
author: George R. R. Martin
year: 1996
---- 4 ----
title: Harry Potter And The Sorcerer's Stone
author: J.K. Rowling
year: 1997
---- 5 ----
title: A Wizard of Earthsea
author: Ursula K. Leguin
year: 1968
---- 6 ----
title: The Way of Kings
author: Brandon Sanderson
year: 2011
== Main Menu ==
1 -> read in books from a file
2 -> write out books to a file
3 -> add books to the collection
4 -> print all books
5 -> delete a book from the collection
6 -> quit the program
Please enter a choice (1 to 6)
2
Enter file name: books2.txt
== Main Menu ==
1 -> read in books from a file
2 -> write out books to a file
3 -> add books to the collection
4 -> print all books
5 -> delete a book from the collection
6 -> quit the program
Please enter a choice (1 to 6)
4
---- 0 ----
title: The Name Of The Wind
author: Patrick Roth
year: 2007
---- 1 ----
title: Lord Of The Rings: The Fellowship of the Ring
author: J. R. R. Tolkien
year: 1954
---- 2 ----
title: Mistborn
author: Brandon Sanderson
year: 2006
---- 3 ----
title: A Game Of Thrones
author: George R. R. Martin
year: 1996
---- 4 ----
title: Harry Potter And The Sorcerer's Stone
author: J.K. Rowling
year: 1997
---- 5 ----
title: A Wizard of Earthsea
author: Ursula K. Leguin
year: 1968
---- 6 ----
title: The Way of Kings
author: Brandon Sanderson
year: 2011
== Main Menu ==
1 -> read in books from a file
2 -> write out books to a file
3 -> add books to the collection
4 -> print all books
5 -> delete a book from the collection
6 -> quit the program
Please enter a choice (1 to 6)
6
Thank you for using our program!
----------------------
RUN 2
----------------------
*** BOOK COLLECTION ***
== Main Menu ==
1 -> read in books from a file
2 -> write out books to a file
3 -> add books to the collection
4 -> print all books
5 -> delete a book from the collection
6 -> quit the program
Please enter a choice (1 to 6)
4
no books in collection
== Main Menu ==
1 -> read in books from a file
2 -> write out books to a file
3 -> add books to the collection
4 -> print all books
5 -> delete a book from the collection
6 -> quit the program
Please enter a choice (1 to 6)
1
Enter file name? books2.txt
== Main Menu ==
1 -> read in books from a file
2 -> write out books to a file
3 -> add books to the collection
4 -> print all books
5 -> delete a book from the collection
6 -> quit the program
Please enter a choice (1 to 6)
4
---- 0 ----
title: The Name Of The Wind
author: Patrick Roth
year: 2007
---- 1 ----
title: Lord Of The Rings: The Fellowship of the Ring
author: J. R. R. Tolkien
year: 1954
---- 2 ----
title: Mistborn
author: Brandon Sanderson
year: 2006
---- 3 ----
title: A Game Of Thrones
author: George R. R. Martin
year: 1996
---- 4 ----
title: Harry Potter And The Sorcerer's Stone
author: J.K. Rowling
year: 1997
---- 5 ----
title: A Wizard of Earthsea
author: Ursula K. Leguin
year: 1968
---- 6 ----
title: The Way of Kings
author: Brandon Sanderson
year: 2011
== Main Menu ==
1 -> read in books from a file
2 -> write out books to a file
3 -> add books to the collection
4 -> print all books
5 -> delete a book from the collection
6 -> quit the program
Please enter a choice (1 to 6)
6
Thank you for using our program!
------------------

In: Computer Science

A comparative balance sheet and income statement is shown for Cruz, Inc. CRUZ, INC. Comparative Balance...

A comparative balance sheet and income statement is shown for Cruz, Inc.

CRUZ, INC.
Comparative Balance Sheets
December 31, 2019
2019 2018
Assets
Cash $ 75,900 $ 18,900
Accounts receivable, net 32,600 40,100
Inventory 68,300 75,300
Prepaid expenses 4,200 3,500
Total current assets 181,000 137,800
Furniture 84,600 99,200
Accum. depreciation—Furniture (13,100 ) (7,500 )
Total assets $ 252,500 $ 229,500
Liabilities and Equity
Accounts payable $ 11,900 $ 16,900
Wages payable 7,100 4,000
Income taxes payable 1,200 2,200
Total current liabilities 20,200 23,100
Notes payable (long-term) 24,800 58,400
Total liabilities 45,000 81,500
Equity
Common stock, $5 par value 177,300 141,500
Retained earnings 30,200 6,500
Total liabilities and equity $ 252,500 $ 229,500

   

CRUZ, INC.
Income Statement
For Year Ended December 31, 2019
Sales $ 392,900
Cost of goods sold 252,900
Gross profit 140,000
Operating expenses
Depreciation expense $ 30,200
Other expenses 71,600 101,800
Income before taxes 38,200
Income taxes expense 13,900
Net income $ 24,300

Required:

Use the indirect method to prepare the operating activities section of the statement of cash flows. (Amounts to be deducted should be indicated with a minus sign.)
  

In: Accounting

a) Discuss the benefits of wireless network communication with a simple example. [3 Marks] b) Explain...

a) Discuss the benefits of wireless network communication with a simple example. [3 Marks]

b) Explain why wireless network communication is slower than wired network communication on most occasions. [2 Marks]

c) Wireless bridges are gaining popularity in connecting discrete campuses or business premises. Discuss the advantages and disadvantages of wireless bridges. [5 Marks]

In: Computer Science

Structurally deficient highway bridges. Data on structurally deficient highway bridges is compiled by the Federal Highway...

Structurally deficient highway bridges. Data on structurally deficient highway bridges is compiled by the Federal Highway Administration (FHWA) and reported in the National Bridge Inventory (NBI). For each state, the NBI lists the number of structurally deficient bridges and the total area (thousands of square feet) of the deficient bridges. The data for the 50 states (plus the District of Columbia and Puerto Rico). For future planning and budgeting, the FHWA wants to estimate the total area of structurally deficient bridges in a state based on the number of deficient bridges

NumberSD

SDArea

1899

432.71

155

60.92

181

110.57

997

347.35

3140

5177.97

580

316.92

358

387.78

20

9.05

24

59.34

302

412.92

1028

344.86

142

39.8

349

135.43

2501

1192.43

2030

688.19

5153

1069.71

2991

527.47

1362

458.37

1780

1453.26

349

131.13

388

236.18

585

521.83

1584

804.15

1156

325.9

3002

692.75

4433

1187.42

473

90.94

2382

335.75

47

20.08

383

127.66

750

752.43

404

196.67

2128

1427.73

2272

1034.61

743

101.42

2862

965.16

5793

1423.25

514

393.96

5802

2404.61

164

237.96

1260

626.38

1216

209.33

1325

481.31

2186

1031.45

233

102.56

500

153.8

1208

483.68

400

502.03

1058

331.59

1302

399.8

389

143.46

241

195.43

e) Build a 90% CI, confidence interval, for coefficient of NumberSD ( ).

f) Repeat (e) with a 95% CI. What is the difference between your answer in (e) and (f)?

In: Statistics and Probability