Questions
Instead of using int.TryParse, use int.Parse instead and use try/catch in C# to handle possible errors...

Instead of using int.TryParse, use int.Parse instead and use try/catch in C# to handle possible errors

using System;
using System.Collections.Generic;
                  
public class Program
{
   public static void Main()
   {
       List<int> list = new List<int>();
      
       Console.WriteLine("Please input integers: (in one line)");
      
      
       string input = Console.ReadLine();
       string[] tokens = input.Split(); // split string into tokens "12 13 10" -> "12" "13" "10"
      
       foreach (string s in tokens) {
           int num;
           bool success = int.TryParse(s,out num); // TryParse returns true if successfully converted s into an int
                   // the converted int is put into the second parameter using keyword "out"  
           // do you know why "out" is used here? why not return the converted integer?
           if (success) {
               list.Add(num); // add num to list if success
           }
       }
      
       Console.WriteLine("Sorted input:");
       list.Sort();
       foreach(int i in list) {
           Console.WriteLine(i);
       }
       Console.WriteLine("Sorted input in reverse:");
       for (int i=list.Count-1;i>=0;i--) {
           Console.WriteLine(list[i]);
       }
      
   }
}

In: Computer Science

In Python And Use List comprehension to solve this question Given a file like this: Blake...

In Python And Use List comprehension to solve this question

Given a file like this:

Blake 4

Bolt 1

De Grasse 3

Gatlin 2

Simbine 5

Youssef Meite 6

Your program when completed should produce output like this:

>>>

In the 2016 100 yard dash the top finishers were:

Blake

Bolt

De Grasse

Gatlin

Simbine

Youssef Meite

The people with a two part name are: ['De Grasse', 'Youssef Meite']

The top three finishers were: ['Bolt', 'De Grasse', 'Gatlin']

Your mission will be to do the following:

1. Develop algorithms to solve all remaining steps in this problem.

2. Use a list comprehension to load the data from a file named “runners.txt”.

3. Use the information read in from the file to print out the names of the top 6 finishers formatted as shown in the example above.

4. Use a list comprehension to create a list of the names that have two parts to them.

5. Use a list comprehension to create a list of the people who finished in the top the positions.

In: Computer Science

Write a program named StringWorks.java that asks the user to input a line of text from...

Write a program named StringWorks.java that asks the user to input a line of text from the keyboard.   Ask the user if they want their answers case sensitive or not. You output should be

  1. the list of words in the sentence including duplicates
  2. A sorted list of the words (alphabetically)
  3. A sorted list of words listed backwards (where z comes before a)
  4. A randomly shuffled list of works
  5. the list of words in the sentence alphabetically removing duplicates.

You need to remove punctuation. Use the Character.isLetterOrDigit() method.

Sample output:

Please type in a sentence:

I love java, and Java loves me! That is cool, yes?

Do you want case sensitivity? (y/n):

n

List of words: i love java and java loves me that is cool yes

Sorted alphabetically: and cool i is java java love loves me that yes

Sorted backwards: yes that me loves love java java is i cool and

Shuffled: java that cool is i love and loves me java yes

Without duplicates, sorted alphabetically: and cool i is java love loves me that yes

In: Computer Science

JAVA You will then prompt the user to enter each grocery item and store it in...

JAVA

You will then prompt the user to enter each grocery item and store it in your array. Afterward, the program will ask the user to enter which grocery item they are looking for in the list, and return a message back on whether it was found or not found.

(Hint: You will need two for-loops for this program - one for storing each element into the array and one for searching back through the array.) See below for example output:

Example output 1:

How many items would you like on your grocery list?

3

Enter item 1:

potato

Enter item 2:

cheesecake

Enter item 3:

bread

Welcome to your digital grocery list!

What item are you looking for?

bread

bread was found in your list!

Example output 2:

How many items would you like on your grocery list?

3

Enter item 1:

potato

Enter item 2:

cheesecake

Enter item 3:

bread

Welcome to your digital grocery list!

What item are you looking for?

muffins

muffins not found.

In: Computer Science

Description: budget Students will create a real-life budget that utilizes the mathematical operators to show monthly...

Description: budget

Students will create a real-life budget that utilizes the mathematical operators to show monthly income, semiannual income, and an annual income. Students will use correct recognizable variables to describe each budgeted item. Please do not use single letter variables points will be deducted. Be sure to use proper documentation regarding comments to identify what you are doing in each part of your code.

List of budgeted items:

Monthly donations such as charities, special-needs, offerings, homeless.

Other items that may be included in the budget: food, restaurants, entertainment, animal care, mortgage, rent, property tax, household repairs, Utilities, cell phone, cable bill, internet, shopping and this may be broken into categories in itself, fuel, car maintenance, parking fees, medical in this can be broken into categories such as primary care, dental, medications, Insurance this may include car insurance, homeowners insurance, identity theft protection, and long term care for those who have aging parents, next category can be household items such as toiletries, laundry detergent, cleaning supplies, tools, next we have personal care this may include gym memberships, streaming memberships, salon services, Babysitting services, child support, alimony, this category can be Credit card services, personal loans, student loans, may also want to add School supplies, any professional conferences, Financial coaching, also possibly savings accounts, and finally such as birthdays, weddings, anniversaries and Christmas.

You do not have to use every single item in every single possible category because not everyone has the same expenses.

Your monthly budget might look like the following example:

Monthly= food, Rent, babysitter, groceries, car payments, car insurance, donations, utilities, cell phone, Health insurance, and entertainment

Semiannual = car_ maintenance, water_ bill, optical _visit, property _ tax, school_ supplies

Annual =   special occasion, birthday Celebration, holiday spending

To find out your Weekly and monthly income you would do the following multiply hourly wage by hours _worked per week. To find your annual salary multiply your weekly income by 52 or 26 and maybe 12 if you get paid monthly.

Students should make sure to include the following print statements at the end of your assignment:

Four print statements that display the following: Weekly income, monthly income, semiannual income, and annual income.

The Final print statement we’ll include your monthly budget minus your monthly income and your annual income minus your semiannual budget.

Please be sure to use the proper format when printing a dollar amount.

(Python Coding)

In: Computer Science

if this is considered more than one question then please explain part 'I' (Find the exact...

if this is considered more than one question then please explain part 'I' (Find the exact value of f100, f500, and f1000, where fn is the nth Fibonacci number. What are times taken to find out the exact values?). I am having trouble writing the code for both recursive and iterative functions without having the program crash. I assume its because the numbers are so high.

Goal: The main goal of the project is to let students use their prior knowledge, try to use the skills they have learnt to solve real world problems. Using this assignment students are required to learn to use the skills they have learned in their previous classes, solve the problems given and reflect on how they can apply it to solve real world issues.

Deliverables: The students are required to submit a written report along with the programs they have written. The report has to address all the prompts mentioned under the Report section. The report should be properly presented by using appropriate font (Time new roman, preferably font size 12 till 16) and grammar.

Tasks:

  1. Write an iterative C++ function that inputs a nonnegative integer n and returns the nth Fibonacci number.
  2. Write a recursive C++ function that inputs a nonnegative integer n and returns the nth Fibonacci number.
  3. Compare the number of operations and time taken to compute Fibonacci numbers recursively versus that needed to compute them iteratively.
  4. Use the above functions to write a C++ program for solving each of the following computational problems.
  1. Find the exact value of f100, f500, and f1000, where fn is the nth Fibonacci number. What are times taken to find out the exact values?
  2. Find the smallest Fibonacci number greater than 1,000,000 and greater than 1,000,000,000.
  3. Find as many prime Fibonacci numbers as you can. It is unknown whether there are infinitely many of these. Find out the times taken to find first 10, 20, 30, 40…up to 200 and draw a graph and see the pattern.

Report: Your report should address all of the below mentioned questions

  1. Describe the Fibonacci series and write briefly what you have done in the assignment.
  2. What are the different skills, programming techniques have you used in order to run the experiments?
  3. What did you observe when you did the comparisons in Task 3 and Task 4? Explain the graph that you have drawn from Task 4.III?
  4. List at least three different applications of the Fibonacci numbers to sciences and describe one of them in details. Think of situation or a real world problem where you can apply concept of Fibonacci numbers to solve it. Explain?
  5. Write a paragraph, explaining what you have done in this assignment. What were the challenges you have faced when solving these problems. How can you improve the programs you have written to solve these problems? How can you use what you have learned going forward?

In: Computer Science

BUSINESS PLAN ASSIGNMENT 1.      The Business Plan project (for a new business) is to be completed and...

BUSINESS PLAN ASSIGNMENT

1.      The Business Plan project (for a new business) is to be completed and submitted on Day 15. Most days will allow time for in class work plan. However, it will still be necessary to do other work on it. The assignment is worth 30% of the course grade.

2.      The Business Plan must be based on a new business you would like to establish. It should be detailed and comprehensive. You may use the sample plans provided in the Entrepreneurship textbook and in the MyEntrepreneurshipLab. You will also be provided access to the LivePlan online software for creating the business plan. Your new business could be a service, retail, or manufacturing function. It could combine 2 of these or even all 3 but remember, KEEP YOUR BUSINESS SMALL AND SIMPLE.

Instructions for your Business Plan Assignment

1.                  The plan’s maximum is 25-40 (depending on the size of the business) double-spaced pages with no more than 8-10 pages of exhibits or Appendix.

2.                  The plan must include an Executive summary, Table of Contents, Mission, Vision and Culture, Company Summary, Market Analysis Summary, Strategy and Implementation Summary, Management and Operations Summary, Financial Plan, Funding Request and Exit Strategy. Appendices including: Sales Forecast, Personnel Plan, General Assumptions, Pro Forma Profit and Loss, Pro Forma Cash flow, Pro Forma Balance Sheet, Resumes, Fact Sheet and complete list of references.

3.                  It should include a detailed marketing plan that identifies the principal target market(s), its size, location and all demographic and psychographic characteristics. Students should also identify and growth trends in the market and provide appropriate statistical information to support that conclusion. Detailed sections are required on the needs filled by the product or service offering, market research conducted, pricing methods and the proposed promotional programs and distribution system.

4.                  The plan should also include a detailed financial plan linked to the requirements and objectives of the marketing plan. This section must cover the business’ first five years and include monthly statements (income, cash flow and balance sheet for Year 1, quarterly statements for Year 2 and annual statements for Year 3-5. Optimistic and pessimistic forecasts should be included as well.

5.                  Financial methods and the scheduled amounts.

6.                  An exit or harvest strategy for the business.

7.                  Identification of the key attributes and skills brought to the business by each team member who will be active in the business and description of how these will be of benefit to the business.

8.                  Delineation of a medium to long-term growth strategy for the business, i.e., expansion and diversification plans.

9.                  A brief description of the human resources, ethical and social policies of the business.

Students will be required to make a 40-minute presentation of their plan. Students will be evaluated on their creativity, enthusiasm, use of audio-visual aids (PowerPoint is strongly recommended) and public speaking skills.

In: Operations Management

I have added the MyList.java all the way on the bottom. Thats all the detail I...

I have added the MyList.java all the way on the bottom.

Thats all the detail I have for this and what kind of more detail information you need.

Plz Write the program in Java. And Plz post the running program with main and test.Thanks.

Implementing Lists:

Start by carefully reading Listing 24.5: MyLinkedList.java (on page 938 of the 11th Edition of the text). Note that the listing is incomplete. Your assignment is to implement a revised MyLinkedList class after you have included all the code needed to fill in and complete all the methods that were omitted. Next, write a (main) driver program that initializes a linked list with 10 names (your choice), and then completely tests every one of its methods of ensure that the class meets all its requirements.

Listing 24.5

MyLinkedList.java
1 public class MyLinkedList implements MyList {
2 private Node head, tail;
3 private int size = 0; // Number of elements in the list
4
5 /** Create an empty list */
6 public MyLinkedList() {
7 }
8
9 /** Create a list from an array of objects */
10 public MyLinkedList(E[] objects) {
11 for (int i = 0; i < objects.length; i++)
12 add(objects[i]);
13 }
14
15 /** Return the head element in the list */
16 public E getFirst() {
17 if (size == 0) {
18 return null;
19 }
20 else {
21 return head.element;
22 }
23 }
24
25 /** Return the last element in the list */
26 public E getLast() {
27 if (size == 0) {
28 return null;
29 }
30 else {
31 return tail.element;
32 }
33 }
34
35 /** Add an element to the beginning of the list */
36 public void addFirst(E e) {
37 // Implemented in Section 24.4.3.1, so omitted here
38 }
39
40 /** Add an element to the end of the list */
41 public void addLast(E e) {
42 // Implemented in Section 24.4.3.2, so omitted here
43 }
44
45 @Override /** Add a new element at the specified index
46 * in this list. The index of the head element is 0 */
47 public void add(int index, E e) {
48 // Implemented in Section 24.4.3.3, so omitted here
49 }
50
51 /** Remove the head node and
52 * return the object that is contained in the removed node. */
53 public E removeFirst() {
54 // Implemented in Section 24.4.3.4, so omitted here
55 }
56
57 /** Remove the last node and
58 * return the object that is contained in the removed node. */
59 public E removeLast() {
60 // Implemented in Section 24.4.3.5, so omitted here
61 }
62
63 @Override /** Remove the element at the specified position in this
64 * list. Return the element that was removed from the list. */
65 public E remove(int index) {
66 // Implemented earlier in Section 24.4.3.6, so omitted
67 }
68
69 @Override /** Override toString() to return elements in the list */
70 public String toString() {
71 StringBuilder result = new StringBuilder("[");
72
73 Node current = head;
74 for (int i = 0; i < size; i++) {
75 result.append(current.element);
76 current = current.next;
77 if (current != null) {
78 result.append(", "); // Separate two elements with a comma
79 }
80 else {
81 result.append("]"); // Insert the closing ] in the string
82 }
83 }
84
85 return result.toString();
86 }
87
88 @Override /** Clear the list */
89 public void clear() {
90 size = 0;
91 head = tail = null;
92 }
93
94 @Override /** Return true if this list contains the element e */
95 public boolean contains(Object e) {
96 // Left as an exercise
97 return true;
98 }
99
100 @Override /** Return the element at the specified index */
101 public E get(int index) {
102 // Left as an exercise
103 return null;
104 }
105
106 @Override /** Return the index of the head matching element in
107 * this list. Return −1 if no match. */
108 public int indexOf(Object e) {
109 // Left as an exercise
110 return 0;
111 }
112
113 @Override /** Return the index of the last matching element in
114 * this list. Return −1 if no match. */
115 public int lastIndexOf(E e) {
116 // Left as an exercise
117 return 0;
118 }
119
120 @Override /** Replace the element at the specified position
121 * in this list with the specified element. */
122 public E set(int index, E e) {
123 // Left as an exercise
124 return null;
125 }
126
127 @Override /** Override iterator() defined in Iterable */
128 public java.util.Iterator iterator() {
129 return new LinkedListIterator();
130 }
131
132 private class LinkedListIterator
133 implements java.util.Iterator {
134 private Node current = head; // Current index
135
136 @Override
137 public boolean hasNext() {
138 return (current != null);
139 }
140
141 @Override
142 public E next() {
143 E e = current.element;
144 current = current.next;
145 return e;
146 }
147
148 @Override
149 public void remove() {
150 // Left as an exercise
151 }
152 }
153
154 private static class Node {
155 E element;
156 Node next;
157
158 public Node(E element) {
159 this.element = element;
160 }
161 }
162 }

MyList.java
public interface MyList extends java.lang.Iterable  {
    //Add a new element at the end of this list
    public void add(E e);

    //Add a new element at the specified index in this list
    public void add(int index, E e);

    //Clear the list
    public void clear();

    //Return true if this list contains the element
    public boolean contains(E e);

    //Return the element from this list at the specified index
    public E get(int index);

    //Return the index of the first matching element in this list.
    //Return -1 if no match.
    public int indexOf(E e);

    /** Return true if this list contains no elements */
    public boolean isEmpty();

    /** Return the index of the last matching element in this list
     * Return -1 if no match. */
    public int lastIndexOf(E e);

    /** Remove the first occurrence of the element o from this list.
     * Shift any subsequent elements to the left.
     * Return true if the element is removed.
     */
    public boolean remove(E e);

    /** Remove the element at the specified position in this list
     * Shift any subsequent elements to the left.
     * Return the element that was removed from the list.
     */
    public E remove(int index);

    /** Replace the element at the specified position in this list
     * with the specified element and returns the new set.
     * */
    public Object set(int index, E e);

    /** Return the number of elements in this list */
    public int size();
}

In: Computer Science

List the following elements in order of highest electronegativity to lowest: silicon, sulphur, argon, chlorine. (2...

List the following elements in order of highest electronegativity to lowest: silicon, sulphur, argon, chlorine.

Answer the following questions about water: (10 marks total)

In a single molecule of water (H2O), what kind(s) of bonds(s) are present?

Explain how these bonds contribute to the high surface tension of water.

Explain why water has a high specific heat and explain why this is important to life.

A baking soda solution has a pH of 8. (5 marks total)

Is it acidic, basic, or neutral? Why?

Is it an acid, a base, or neither? Why?

What is the concentration of hydrogen ions in baking soda? (1 mark)

Compare and contrast the following: (4 marks each, total 16 marks)

Starch and glycogen

Phosphodiester bonds and peptide bonds

Chemical energy and heat

Hypothesis and null hypothesis

For the theory of evolution identify the pattern component and the process component.

Read the section in your textbook Canadian Research 1.1: Artificial Selection on Bighorn Sheep in Alberta. Using specific examples from this study, outline the steps of the scientific method. (Note that the reading may not include all the steps. For any “missing” steps, include what would have been the case.)

Answer the following questions about enzymes: (15 marks total)

Briefly describe how enzymes catalyze reactions

List 4 factors that affect enzyme activity. For each factor explain how the factor works to alter reaction rate.

The tertiary structure of proteins involves interactions with the amino acid side chains (the R groups). List the types of interactions and explain the role of the functional groups involved .

Compare and contrast the structure and function of DNA and RNA.

Explain why the components of phospholipids contribute to the formation of lipid bilayers.

Explain why carbohydrates have high free energy.

Discussion

Based on what you have learned so far, consider one of the following questions. Post your ideas to the Discussions area first, and then read and respond to other students’ postings. The Discussions area is in the left-hand navigation menu of this course.

Self-Replicating Molecules

Your textbook states that the ability of molecules to self-replicate is an indicator that these molecules are “living entities”. Should self-replication be the only indicator of life? Why or why not?

Origins of Life

Up to date RNA has been the only molecule directly associated with the origin of life and early evolution of life on Earth.

In your own words explain how researchers came to this conclusion. Do you find their arguments convincing? Why or why not? Prior to answering this question, make sure you read Chapter 4, Section 4.4, The First-Life Form.

In: Biology

In 6A, you created an object class encapsulating a Trivia Game which INHERITS from Game. Now...

In 6A, you created an object class encapsulating a Trivia Game which INHERITS from Game.

Now that you have successfully created Trivia objects, you will continue 6B by creating a linked list of trivia objects. Add the linked list code to the Trivia class.

Your linked list code should include the following: a TriviaNode class with the attributes:

1. trivia game - Trivia object

2. next- TriviaNode

3. write the constructor, accessor, mutator and toString methods.

A TriviaLinkedList Class which should include the following attributes:

1. head - TriviaNode

2. number of items – integer

3. write the code for the constructor, accessor and mutator, and toString methods.

4. methods to insert a triviaNode on the list - You may assume inserts always insert as the first node in the list.

5. write a method to delete a node by passing the node id of the game to delete. Take into consideration that the game may not exist in the list. Your method should let the user know that the node was successfully deleted or not.

Write a client to test all aspects - creating trivia objects, inserting the objects as nodes to the list, deleting a node by passing the id of the trivia game. Print out the list every time you make a change such as adding a node and deleting a node. You should create at least 5 objects to be inserted to your list, then delete at least 1. Also, test deleting an object that is not in the list.

6B. In this module, you will combine your knowledge of class objects, inheritance and linked lists. You will need to first create an object class encapsulating a Trivia Game which INHERITS from Game.

Game is the parent class with the following attributes:

  1. description - which is a string
  2. write the constructor, accessor, mutator and toString methods.

Trivia is the subclass of Game with the additional attributes:

1. trivia game id - integer

2. ultimate prize money - double

3. number of questions that must be answered to win - integer.

4. write the accessor, mutator, constructor, and toString methods.

Write a client class to test creating 5 Trivia objects. Once you have successfully created Trivia objects, you will continue 6B by adding a linked list of trivia objects to the Trivia class.

In: Computer Science