How would I write a code from this following word problem?
3. Use the pow() and sqrt() functions to compute the roots of a quadratic equation. Enter the three coefficients with a single input statement. Warning: if you give sqrt() a negative value, the function cannot produce a valid answer.
In: Computer Science
Every COBOL program I've browsed professionally has had Paragraph numbers. It is somewhat of Programmer Preference/Art within some general guidelines established by the organization. Reference the references based on your searches, and provide:
1) What you think are the purposes & advantages of numbering paragraphs.
2) Guidelines you suggest for numbering paragraphs.
Please do not cut/paste website text. I've already read that, and that is really the only wrong answer here. The idea of the assignment is assimilate, ascertain & express in simple terms the purpose, advantage & guidelines you'd suggest. This is not a novel; use brief paragraphs and or bullet points.
Lincoln was asked to appear upon some important occasion and deliver a five-minute speech, he said that he had no time to prepare five-minute speeches, but that he could go and speak an hour at any time. The point here, is that with a little planning, it does not take a lot of words to express your point.
In: Computer Science
Case Study Baseball Team Manager
For this case study, you’ll use the programming skills that you learn in Murach’s Python Programming to develop a program that helps a person manage a baseball team. This program stores the data for each player on the team, and it also lets the manager set a starting lineup for each game.
After you read chapter 2, you can develop a simple program that calculates the batting average for a player. Then, after you complete most of the other chapters, you can enhance and improve this program. 1
General guidelines
Naming
When creating the folder and file names for your programs, please use the conventions specified by your instructor. Otherwise, for a program that consists of a single file, use this naming convention: first_last_baseball_wkXX.py where first_last specifies your first and last name and wkXX specifies the chapter number, as in wk05. For programs that have multiple files, store the files in a folder named first_last_baseball_wkXX.
When creating names for variables and functions, please use the guidelines and recommendations specified by your instructor. Otherwise, use the guidelines and recommendations specified in Murach’s Python Programming.
User interfaces
You should think of the user interfaces that are shown for the case studies as starting points. If you can improve on them, especially to make them more user-friendly, by all means do so.
Specifications
You should think of the specifications that are given for the case studies as starting points. If you have the time to enhance the programs by improving on the starting specifications, by all means do so.
Top-down development
Always start by developing a working version of the program. That way, you’ll have something to show for your efforts if you run out of time. Then, you can build out that version of the program until it satisfies all of the specifications.
From chapter 5 on, you should use top-down coding and testing as you develop your programs. You might also want to sketch out a hierarchy chart for each program as a guide to your top-down coding.
Improve number and string formatting
Update the program to improve the formatting of the numbers and the strings.
Console
================================================================
Baseball Team Manager
MENU OPTIONS
1 – Display lineup
2 – Add player
3 – Remove player
4 – Move player
5 – Edit player position
6 – Edit player stats
7 - Exit program
POSITIONS
C, 1B, 2B, 3B, SS, LF, CF, RF, P
================================================================
|
Menu option: 1 |
POS |
AB |
H |
AVG |
|
Player |
----------------------------------------------------------------
|
1 |
Denard Span |
CF |
545 |
174 |
0.319 |
|
2 |
Brandon Belt |
1B |
533 |
127 |
0.238 |
|
3 |
Buster Posey |
C |
535 |
176 |
0.329 |
|
4 |
Hunter Pence |
RF |
485 |
174 |
0.359 |
|
5 |
Brandon Crawford |
SS |
532 |
125 |
0.235 |
|
6 |
Eduardo Nunez |
3B |
477 |
122 |
0.256 |
|
7 |
Joe Panik |
2B |
475 |
138 |
0.291 |
|
8 |
Jarrett Parker |
LF |
215 |
58 |
0.270 |
|
9 |
Madison Bumgarner |
P |
103 |
21 |
0.204 |
Menu option: 7
Bye!
!!Specifications !! (Question that needs to be answered
Use the multiplication operator to make sure that horizontal separator lines use 64 characters
Use spaces, not tabs, to align columns. This should give the program more control over how the columns are aligned.
Make sure the program always displays the batting average with 3 decimal places. Display the positions by processing the tuple of valid positions.
In: Computer Science
1. Create a color image of size 200 × 200. The image should have a blue background.
2. Create 100 yellow regions within the image that have a variable size. More specifically, their width should be an odd number and vary between 3 and 7 and their height should also be an odd number and vary between 3 and 7. For example, you may get rectangular regions of size 3 × 3, 3 × 5, 5 × 3, 5 × 5, 7 × 5, etc. These 100 yellow regions should be placed at random locations within the 200 × 200 image, but we should make sure that they do not overlap with each other. Important: These regions should be created by modifying the image pixels, and not as plots on top of the image. In other words, these regions should be part of the image.
3. Plot horizontal and vertical white lines on top of the image for every 40 pixel rows and every 40 pixel columns. Now, these white lines will not be part of the image, but an extra layer on top of the image. You may use hold on and hold off, and also plot to achieve this. Display the image with the yellow regions and the white lines in figure(1).
This is what i have for 1 and 2, which is working correctly
clear all;
close all;
clc;
im=zeros(200,200,3);%image
im(:,:,3)=1;
for i=1:100
while true;
w=2*round(1+2*rand(1,1))+1;
h=2*round(1+2*rand(1,1))+1;
x=round(1+(199-w)*rand(1,100));
y=round(1+(199-h).*rand(1,100));
x_dash=x+w;
y_dash=y+h;
if all(im(x:x_dash,y:y_dash,2)!=1)
im(x:x_dash,y:y_dash,3)=0;
im(x:x_dash,y:y_dash,1:2)=1;
break;
end
end
end
Need help with Part 3
In: Computer Science
[PYTHON] Two natural number p,q are called coprime if there are no common prime factors in their prime factorization. E.g. 15 and 20 are not coprime because 5 is a common prime number in their prime factorization, while 20 and 9 are coprime. The Euler’s phi function, φ(n), counts the number of all natural numbers ≤ n which are coprime to n. E.g. φ(9) = 6, as all natural numbers ≤ 9 are 1,2,3,4,5,6,7,8,9. And out of these, the numbers coprime to 9 are 1,2,4,5,7 and 8, a total of 6 natural numbers.
You are required to write a Python function totient(n) that accepts a natural number as input argument and returns the following:
1. a list of all the natural numbers less than or equal to n which are coprime to n; and
2. the result of the Euler’s phi function when run on n.
E.g. totient(9) should return [1,2,4,5,7,8], 6
You can use your function prime factors from Problem 2. to determine if two numbers are coprime or not.
In: Computer Science
Create a program that asks the user to input three numbers and computes their sum. This sounds simple, but there's a constraint. You should only use two variables and use combined statements. You can use the output below as a guide. Please enter the first number: 4 Please enter the second number: 2 Please enter the third number: 9 The sum of the three numbers is: 15.
In: Computer Science
Discuss and gather insight and feedback on the importance of data models and how to discover business rules and interpret them as an information resource.
In: Computer Science
1.Instead of Build-Max-Heap, we could use Heap-Insert-Max to
build a tree with heap property. Write a pseudocode for that
procedure, also evaluate it’s time complexity.
2. How Insertion sort works on the following array
[16, 12, 3, 27, 9, 4, 5, 7]]
In: Computer Science
explain why using email address as the primary key for Staff is a bad idea
In: Computer Science
(C++)Counting Sort: Write C++ codes for counting sort. The input array is A = {20, 18, 5, 7, 16,
10, 9, 3, 12, 14, 0}
In: Computer Science
Describe how to select various cable media and network interface cards (NIC) options for your own home network configuration. Be sure to discuss what you would want for the optimal situations for your network. Brainstorm with other students to improve upon their optimal situation or provide an alternative idea for their situation.
In: Computer Science
I need this written in Java, it is a Linked List and each of it's Methods. I am having trouble and would appreciate code written to specifications and shown how to check if each method is working with an example of one method being checked. Thank you.
public interface Sequence <T> {
/**
* Inserts the given element at the specified index position within the sequence. The element currently at that
* index position (and all subsequent elements) are shifted to the right.
*
* @param index the index at which the given element is to be inserted
* @param x the element to insert
* @return {@code true} if and only if adding the element changed the sequence
* @throws IndexOutOfBoundsException if the index is invalid {@code (index < 0 || index > size())}
* @throws NullPointerException if the given element is {@code null}
*/
boolean add(int index, T x) throws IndexOutOfBoundsException, NullPointerException;
/**
* Adds the specified element to the end of the sequence.
*
* @param x the element to add
* @return {@code true} if and only if adding the element changed the sequence
* @throws NullPointerException if the given element is {@code null}
*/
boolean add(T x) throws NullPointerException;
/**
* Removes all of the elements from the sequence.
*/
void clear();
/**
* Check if the given element belongs to the sequence.
*
* @param x the element to check for
* @return {@code true} if and only if the sequence contains the given element
* @throws NullPointerException if the given element is {@code null}
*/
boolean contains(T x) throws NullPointerException;
/**
* Returns the element at the given position in the sequence.
*
* @param index the index of the element to return
* @return the element at the given position in the sequence
* @throws IndexOutOfBoundsException if the index is invalid {@code (index < 0 || index >= size())}
*/
T get(int index) throws IndexOutOfBoundsException;
/**
* Returns the index position of the first occurrence of the given element within the sequence or -1 if it does not
* belong.
*
* @param x the element to search for
* @return the index position of the first occurrence of the given element within the sequence or -1 if it does not
* belong
* @throws NullPointerException if the given element is {@code null}
*/
int indexOf(T x) throws NullPointerException;
/**
* Check if the sequence is empty.
*
* @return {@code true} if and only if the sequence is empty.
*/
boolean isEmpty();
/**
* Removes the element at the given position in the sequence.
*
* @param index the index position of the element to be removed
* @return the element at the given position in the sequence
* @throws IndexOutOfBoundsException if the index is invalid {@code (index < 0 || index >= size())}
*/
T remove(int index) throws IndexOutOfBoundsException;
/**
* Remove the first occurrence of the given element from the sequence (if present).
*
* @param x the element to be removed from this list
* @return {@code true} if and only if removing the element changed the sequence
* @throws NullPointerException if the given element is {@code null}
*/
boolean remove(T x) throws NullPointerException;
/**
* Replaces the element at the given position of the sequence with the specified element.
*
* @param index index of the element to replace
* @param x the new element
* @throws IndexOutOfBoundsException if the index is invalid {@code (index < 0 || index >= size())}
* @throws NullPointerException if the given element is {@code null}
*/
void set(int index, T x) throws IndexOutOfBoundsException, NullPointerException;
/**
* Returns the number of elements in this sequence.
*
* @return the number of elements in this sequence
*/
int size();
/**
* Returns an array containing all of the elements in this sequence (preserving their order).
*
* @return an array containing all of the elements in this sequence (preserving their order)
*/
Object[] toArray();
}In: Computer Science
(C++)Radix Sort: Write C++ codes for radix sort: use counting sort for decimal digits from
the low order to high order. The input array is A = {329, 457, 657, 839, 436, 720, 353}
In: Computer Science
Write a program, called NationalTax, that will simulate calculating a citizen's income tax for the year.
A country uses lettered ID's to identify its citizens. Valid ID's will be either 8 or 9 characters long. All characters entered will be alphabetic characters only (a-z or A-Z).
In: Computer Science
Part 1: Write a program that finds the sum and average of a series of numbers entered by the user. The program will first ask the user how many numbers there are. It then prompts the user for each of the numbers in turn and prints out the sum, average, the list of number from the user. Note: the average should always be a float, even if the user inputs are all ints.
Part 2: Same as part 1 except now the numbers are to
be read in from a file.
File contains a single line of numbers delimited by comma. Example:
8, 39, 43, 1, 2, 3
Part 3: Part 2 but modular ( i.e. using
functions).
Assume the file name is passed to the function as a parameter. The
function then opens the file, reads in the numbers, then computes
and returns the sum and average of the numbers.
In: Computer Science