Questions
Background: introduction to "Wrapper" classes, this is a tool or concept provided in the Java Programming...

Background: introduction to "Wrapper" classes, this is a tool or concept provided in the Java Programming Language that gives us a way to utilize native datatypes as Objects with attributes and methods. A Wrapper class in Java is the type of class which contains or the primitive data types. When a wrapper class is created a new field is created and in that field, we store the primitive data types. It also provides the mechanism to covert primitive into object and object into primitive.Working with collections, we use generally generic ArrayList<Integer> instead of this ArrayList<int>. An integer is wrapper class of int primitive type. We use a Java wrapper class because for generics we need objects, not the primitives."

Problem: Create a Word Counter application, submit WordCounter.java.

Word Counter takes input of a text file name (have a sample file in the same directory as your Word Counter application to we don't have to fully path the file). The output of our Word Counter application is to echo the file name and the number of words contained within the file.

Sample File: Hello.txt:

hello

hello

hello

hello

hello

hello

hello

hello

hello

hello

In: Computer Science

Using this code snippet: Answer the following questions <div id=”mainContent”>      <p>I’m a cool paragraph <span>...

Using this code snippet: Answer the following questions

<div id=”mainContent”>

     <p>I’m a cool paragraph

<span>

    that has some

                  <span class=”coolClass”>yellow</span>

                  text

            </span>

     </p>

     <p class=”blue”>

            I’m just some blue text

      </p>

      <p class=”coolClass”> I should be un-touched text </p>

</div>

<div id=”footer”>

     <p class=”tagLine”>Copyright &copy; 2014</p>

</div>

1. Write the CSS rule (selector/declaration) to change all elements with a class of ‘blue’ to have blue foreground text. Hint: color

2. Write the CSS rule to change just the span with a class of “coolClass” to have a text color of yellow.

3. Write the CSS rule to change the element with and id of ‘footer’ to have a font size of 12px. Hint: font-size

4. Write the CSS needed to make all paragraphs in the document have a font weight of bold. Hint: font-weight

In: Computer Science

Below are the parallel arrays that track a different attribute of the apples (note that the...

Below are the parallel arrays that track a different attribute of the apples (note that the above chart (Sweet-Tart Chart) doesn't align with the data from the previous lesson):

 
 

names = ["McIntosh", "Red Delicious", "Fuji", "Gala", "Ambrosia", "Honeycrisp", "Granny Smith"]

 

sweetness = [3, 5, 8, 6, 7, 7.5, 1]

 

tartness = [7, 1, 3, 1, 1, 8, 10]

Step 1: Data Model (parallel arrays to dictionary)

Build a dictionary named apples. The apple dictionary keys will be the names of the apples. The values will be another dictionary. This value dictionary will have two keys: "sweetness" and "tartness". The values for those keys will be the respective values from the sweetness and tartness lists given above. You will build this by defining a variable named apples (see the complex_map example).

This is why dicitionarries are also calleed associative arrays. The arrays need to be kept in order so they can associate the same index with the same corrresoponding value that make holding this kind of data easier.

Step 2: Apple Aid

Now that we have our model, create a function named by_sweetness whose parameter will be a tuple (from apples.items()) The function by_sweetness will return the sweetness value of the incoming tuple. This helper function cannot reference the global variable apples (from step 1).

Create another function by_tartness that is essentially the same as by_sweetness but returns the tartness value of the incoming tuple.

Step 3: Apple Sorting

Write a function called apple_sorting that has two parameters: data (the data model dictionary) and sort_helper (the function used to sort the model). The apple_sorting should use the sorted function to sort the data (e.g. data.items()) with sort_helper. The function returns a list of tuples in order of their sweetness (sweetest apples listed first).

Once done, this should work:

 
 

print(apple_sorting(apples, by_sweetness))

In: Computer Science

Provide brief definitions and an example for each of the following. a. acute care b. ALOS...

Provide brief definitions and an example for each of the following.

a. acute care

b. ALOS

c. Chronic disease

d. Data Mart

e. BI

In: Computer Science

Regarding clinician use of the EMR/EHR, when is the best time to access and document into...

Regarding clinician use of the EMR/EHR, when is the best time to access and document into the EMR/EHR? Explain.

In: Computer Science

There are three steps (open, action, close) required for handling files. You need to write a...

There are three steps (open, action, close) required for handling files. You need to write a Python program what executes each of these three steps. Your program must include:
 Extensive comments to ensure explanation of your code (1).
 Open a file (file name must include your student number, thus filexxxxxxxx.txt). (1).
 Write the details of the five students (from Question 1 above) to a file (3).
 Close the file. (1)
 Then open the file again (1).
 Write the contents of the file to display on the screen (3).

In: Computer Science

Taking as a reference a sensor that delivers a reading through a parallel bus at a...

Taking as a reference a sensor that delivers a reading through a parallel bus at a rate of 12 bits/ms, carry out a program within MARIE's environment that stores the first 50 measurements in memory.

In: Computer Science

UseMath Write a program called UseMath. It should contain a class called UseMath that contains the...

 

UseMath

Write a program called UseMath. It should contain a class called UseMath that contains the method main. The program should ask for a number from the user and then print the information shown in the examples below. Look at the examples below and write your program so it produces the same input/output.

Examples

(the input from the user is in bold face) % java UseMath enter a number: 0 the square root of 0.0 is: 0.0 rounded to the nearest integer: 0 the value of PI is: 3.141592653589793 the value of PI plus your number is: 3.141592653589793 rounded to the nearest integer: 3 the value of E plus your number is: 2.718281828459045 the absolute value of your number is: 0.0 % java UseMath enter a number: 1 the square root of 1.0 is: 1.0 rounded to the nearest integer: 1 the value of PI is: 3.141592653589793 the value of PI plus your number is: 4.141592653589793 rounded to the nearest integer: 4 the value of E plus your number is: 3.718281828459045 the absolute value of your number is: 1.0 % java UseMath enter a number: -1 the square root of -1.0 is: NaN rounded to the nearest integer: 0 the value of PI is: 3.141592653589793 the value of PI plus your number is: 2.141592653589793 rounded to the nearest integer: 2 the value of E plus your number is: 1.718281828459045 the absolute value of your number is: 1.0 % java UseMath enter a number: .5 the square root of 0.5 is: 0.7071067811865476 rounded to the nearest integer: 1 the value of PI is: 3.141592653589793 the value of PI plus your number is: 3.641592653589793 rounded to the nearest integer: 4 the value of E plus your number is: 3.218281828459045 the absolute value of your number is: 0.5 % java UseMath enter a number: .1 the square root of 0.1 is: 0.31622776601683794 rounded to the nearest integer: 0 the value of PI is: 3.141592653589793 the value of PI plus your number is: 3.241592653589793 rounded to the nearest integer: 3 the value of E plus your number is: 2.818281828459045 the absolute value of your number is: 0.1 % java UseMath enter a number: 10 the square root of 10.0 is: 3.1622776601683795 rounded to the nearest integer: 3 the value of PI is: 3.141592653589793 the value of PI plus your number is: 13.141592653589793 rounded to the nearest integer: 13 the value of E plus your number is: 12.718281828459045 the absolute value of your number is: 10.0 %

In: Computer Science

This is a java program I am trying to figure out how to add a couple...

This is a java program

I am trying to figure out how to add a couple methods to a program I am working on.

I need to be able to:

1. Remove elements from a binary tree

2. Print them in breadth first order

Any help would appreciated.

//start BinaryTree class

/**
*
* @author Reilly
* @param <E>
*/
public class BinaryTree {

TreeNode root = null;
TreeNode current, parent;
private int size = 0, counter = 0;

public int getSize() {
return this.size;
}

public boolean insert(int el) {
current = root;

if (current == null) {
root = new TreeNode(el);
} else {
parent = null;
current = root;

while (current != null) {
if (el < current.element) {
parent = current;
current = current.left;
} else if (el > current.element) {
parent = current;
current = current.right;
} else {
return false;
}
}

if (el < parent.element) {
parent.left = new TreeNode(el);
}
if (el > parent.element) {
parent.right = new TreeNode(el);
}
}

this.size++;
return true;
}

public boolean search(int el) {
current = root;
while (current != null) {
if (el < current.element) {
current = current.left;
} else if (el > current.element) {
current = current.right;
} else {
return true;
}
}
return false;
}

public void inorder() {
inorder(root);
System.out.print("\n");
}

public void inorder(TreeNode curRoot) {
if (curRoot == null) {
return;
}
inorder(curRoot.left);
System.out.print(curRoot.element + " ");
inorder(curRoot.right);
}

public void postorder() {
postorder(root);
System.out.print("\n");
}

public void postorder(TreeNode curRoot) {
if (curRoot == null) {
return;
}
postorder(curRoot.left);
postorder(curRoot.right);
System.out.print(curRoot.element + " ");
}

public void getNumberOfLeaves() {
if (oddOrEven(getNumberOfLeaves(root))) {
System.out.println("Even");
} else {
System.out.println("Odd");
}
}

int getNumberOfLeaves(TreeNode curRoot) {
if (curRoot == null) {
return 0;
}
if (curRoot.left == null && curRoot.right == null) {
return 1;
} else {
return getNumberOfLeaves(curRoot.left) + getNumberOfLeaves(curRoot.right);
}
}

public boolean oddOrEven(int x) {

return (x % 2) == 0;

}

}

//start Driver class

public class Driver {

public static void main(String[] args) {
BinaryTree tree = new BinaryTree();

tree.insert(10);
tree.insert(5);
tree.insert(15);
tree.insert(6);
tree.insert(4);
tree.insert(20);
  
tree.inorder();
tree.getNumberOfLeaves();

tree.inorder();
  
}
  
}

//start TreeNode class

public class TreeNode {
int element;
TreeNode left;
TreeNode right;
  
public TreeNode(int el)
{
this.element = el;
}
}

In: Computer Science

The five key activities in an object-oriented design process are: a. Define the context and modes...

The five key activities in an object-oriented design process are:

a. Define the context and modes of use of the system;
b. Design the system architecture;
c. Identify the principal system objects;
d. Develop design models;
e. Specify object interfaces.

Please give me an explanation and example in detail for the five activities.

In: Computer Science

The language is C++ Below are a list of sequences of numbers. Your job is to...

The language is C++

Below are a list of sequences of numbers. Your job is to program each sequence with any loop of your preference (while, for, do/while). I want the code to output the sequence provided and the next number in the sequence (you can output more but there is 1 sequence that may only have 1 number after).. Please order and notate each sequence in your output –. The output should also be horizontal like that shown below (if you output it vertically it will be -10pts). Each sequence should be programed with only 1 loop and optionally 1 selection statement. Hint: a selection statement may be used for the last 3 problems.

Series 1:

15, 14, 13, 12, 11, ...

Series 2:

1, 2, 5, 14, 41, ...

Series 3:

2, 3, 5, 8, 12, 17, ...

Series 4:

15, 13, 11, 9, 7, ...

Series 5:

71, 142, 283, 564, 1125, 2246, 4487, 8968, ...

Series 6:

10, 5, 1, -2, -4, -5, -5, -4, -2, ...

Series 7:

0, 1, 3, 7, 15, 31, 63, ...

Series 8:

0, 1, 4, 13, 40, 121, ...

Series 9:

15, 29, 56, 108, 208, 400…

series 10: (finite)

0, 1, 3, 6, 10, 10, 11, 13, 16, 16, 17, 19, 19, ...

series 11:

7, 9, 14, 20, 27, 33, 42, 52, 63, 73, 86, ...

Series 12:

13, -21, 34, -55, 89 ...

Series 13:

0, 1, 4, 12, 32, 80, 192, ...

In: Computer Science

Generate all permutations of {3, 8, 2} by the Johnson-Trotter algorithm. Show the steps.

Generate all permutations of {3, 8, 2} by the Johnson-Trotter algorithm. Show the steps.

In: Computer Science

Problem 1 The United States Federal Income tax for taxes due July 15, 2020 is available...

Problem 1
        The United States Federal Income tax for taxes due July 15, 2020
    is available at this link: https://www.bankrate.com/finance/taxes/tax-brackets.aspx
        The four tax filing categories are: 0 - single filer, 2 - head of household, 
        3 - married filing jointly or qualifying widow, and 4 - married filing
        seperately. 
        
        Write a Java program that prompts the user to enter the name, filing status, and
        annual income. The program returns the federal income tax due. (10 Points)
        
        A sample run should look like:
        Enter your name: Jane Doe
        Enter your 2019 federal income: 48,000
        Enter your filing status: single
        
        Jane Doe, the federal income tax for an annual salary of
        48,000 for a single filer is $4,800.
        
        
        Draw a UML diagram for the class. You may use Astah tool. (5 points).
        
        
        Submit both the java code and UML diagram.
*       

In: Computer Science

This is a beginner C++ class Your program will be creating 10 library books. Each library...

This is a beginner C++ class

Your program will be creating 10 library books. Each library book will have a title, author and publishing year. Each library book will be stored as a structure and your program will have an array of library books (an array of structures).

After creating the struct, the next task is to create a new separate array for book genres.

You will create this corresponding array of book genres: Mystery, Romance, Fantasy, Technology, Children, etc. If the first element of the structure is storing information about a book titled : "More about Paddington", then the corresponding first element of array book genre would indicate 'Children'.

You should only use structure and array. You are not allowed to use vectors.

The user of your program should be able to select what they want to do from a menu of the following things and your program needs to do what the menu selection indicates:

* Print the entire list of library books (including the title, author, publishing year and book genre)

* Display a count of how many books exist per genre

* Find and display all books where the publishing year is greater than the year user put in

* Print the titles of the books where the Genre may be indicated by a 'C' for Children, & 'M' for Mystery

In: Computer Science

Java Counter Program I can't get my program to add the number of times a number...

Java Counter Program

I can't get my program to add the number of times a number was landed on for my if statements for No12 through No2.

My Code:

import java.util.Scanner;
import java.util.Random;
   import java.lang.*;
  
   public class Dice
   {
      
       public static void main(String[] args)
       {
           Scanner in = new Scanner(System.in);
           int Continue = 1;
           //randomnum = new Random();
          
           do
           {
           RollDice();
          
           System.out.print("Would you like to go again? (Yes = 1, No =2");
           Continue = in.nextInt();
           }while(Continue == 1);  
       }

   public static void RollDice ()
   {
       Scanner in = new Scanner(System.in);
       //int die1;
       //int die2;
       int dieTotal;
       int times;
       int rollCount =1;
       int i,temp=0;
       int rollCounto = 1;
      
           int No12=0;
           int No11=0;
           int No10=0;
           int No9=0;
           int No8=0;
           int No7=0;
           int No6=0;
           int No5=0;
           int No4=0;
           int No3=0;
           int No2=0;
           Random diceRoller = new Random();
           System.out.print("Enter amount of rolls desired");  
       for(i=0; i<rollCounto;i++)
       {
           rollCounto = in.nextInt();
           rollCount = rollCounto;
          
           do
           {
               int die1 = diceRoller.nextInt(6) +1;
               int die2 = diceRoller.nextInt(6) +1;
               dieTotal = (die1 + die2);
               if(dieTotal == 12)
               {
                   No12= No12++;  
               }
               if(dieTotal == 11)
               {
                   No11= No11++;  
               }
               if(dieTotal == 10)
               {
                   No10= No10++;  
               }
               if(dieTotal == 9)
               {
                   No9= No9++;  
               }
               if(dieTotal == 8)
               {
                   No8= No8++;  
               }
               if(dieTotal == 7)
               {
                   No7= No7++;  
               }
               if(dieTotal == 6)
               {
                   No6= No6++;  
               }
               if(dieTotal == 5)
               {
                   No5= No5++;  
               }
               if(dieTotal == 4)
               {
                   No4= No4++;  
               }
               if(dieTotal == 3)
               {
                   No3= No3++;  
               }
               if(dieTotal == 2)
               {
                   No2= No2++;  
               }
               rollCount = (rollCount - 1);
           }while(rollCount >0);
           System.out.println("\n2 | " + No2 + "/36" + "\n3 | " + No3 + "/36" + "\n4 | " + No4 + "/36" + "\n5 | " + No5 + "/36" + "\n6 | " + No6 + "/36" +
           "\n7 | " + No7 + "/36" + "\n8 | " + No8 + "/36" + "\n9 | " + No9 + "/36" + "\n10 | " + No10 + "/36" + "\n11 | " + No11 + "/36" + "\n12 | " + No12 + "/36");
       break;
       }
      
      
   }
   }

In: Computer Science