C++
Write a program that declares two variables:a string firstName and int age.Write a function, called getName, that when called, prompts the user for their first name.
The function should return the first name and store it in the firstName variable.
Write a function, called getAge, that when called, prompts the user for their age.
The function should return the age and store it in the age variable.
Write a function, that uses the firstName and age as arguments.In the function, print out the person’s name and age.
In: Computer Science
In: Computer Science
1 Pick the HTML snippet that uses a non-modifiable input named “recipient” with the value “edmonds [email protected]”.
Group of answer choices
a <input type="submit" name="recipient" value="[email protected]">
b <input type="text" name="recipient" value="[email protected]">
c <input type="value" name="recipient" value="[email protected]">
d <input type="hidden" name="recipient" value="[email protected]">
2 Which of the following is the most accurate statement regarding internal hyperlinks?
Group of answer choices
a The “internal” refers to the host machine on which the browser is running
b The “internal” refers to the internal contents of a table
c Internally-linked location names can be assigned to any id in an HTML5 document
d href="page.html&name" is the proper format used to link to an internal location of another page
3 The ______________ element provides input options for a text input element. The browser can use these options to display autocomplete options to the user (hint: this can be used regardless of a user’s previous form inputs).
a value
b datalist
c step
d autocomplete
In: Computer Science
In: Computer Science
You are asking to develop a “Triangle Guessing” game in Python for the assignment. The program accepts the lengths of three (3) sides of a triangle as input from a player. The program output should indicate whether the triangle is a right triangle, an acute triangle, or an obtuse triangle.
1.Tips to help you for this assignment: 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. Develop your game/program a user friendly one. Document your program by adding comments: Introduce/describe the program including the author, date, goal/purpose of the program Document every variable used at the program even the name is meaningful 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”
6. Testing your program for all possible input and every of the 3 possible triangles
In: Computer Science
Too often, statistics are used to ‘prove’ some point or to persuade an audience to some particular point of view, without really being accurate, complete, or honest. This issue has been the subject of numerous texts. You may be interested in reading such titles as Damned Lies and Statistics, or How to Lie with Statistics. Explain why the use of analytics contributed to the problem. Discuss the consequences of the matter. Did the company/organization involve suffer any adverse consequences?
In: Computer Science
Convert the attached C++ code to working Java code. Be judicious in the change that you make. This assignment is not about re-writing or improving this code, but rather about recognizing the differences between C++ and Java, and making the necessary coding changes to accommodate how Java does things. PLEASE DO NOT use a built-in Java QUEUE (or any other) container. Additional resources for assignment:
#include <iostream>
#include <string>
using namespace std;
class pizza
{
public:
string ingrediants, address;
pizza *next;
pizza(string ingrediants, string address)
{
this->address = address;
this->ingrediants = ingrediants;
next = NULL;
}
};
void enqueue(pizza **head, pizza **tail, pizza *thispizza)
{
if (*head == NULL) *head = thispizza;
else (*tail)->next = thispizza;
*tail = thispizza;
return;
}
pizza* dequeue(pizza **head, pizza **tail)
{
pizza* pizzatodeliver = NULL;
if (*head != NULL)
{
pizzatodeliver = *head;
*head = (*head)->next;
}
if (*head == NULL) *tail = NULL;
return pizzatodeliver;
}
void deliver(pizza **head, pizza`** tail)
{
pizza *thispizza = dequeue(head, tail);
if (thispizza == NULL)
{
cout << "No deliveries pending" << endl; return;
}
cout << "Deliver a pizza with " << thispizza->ingrediants
<< " to " << thispizza->address << endl;
}
int main()
{
pizza *first = NULL, *last = NULL;
enqueue(&first, &last, new pizza("pepperoni", "1234 Bobcat Trail"));
enqueue(&first, &last, new pizza("sausage", "2345 University Drive"));
deliver(&first, &last);
enqueue(&first, &last, new pizza("extra cheese", "3456 Rickster Road"));
enqueue(&first, &last, new pizza("everything", "4567 King Court"));
enqueue(&first, &last, new pizza("coffee beans", "5678 Java Circle"));
deliver(&first, &last);
deliver(&first, &last);
deliver(&first, &last);
deliver(&first, &last);
deliver(&first, &last);
cin.get();
return 0;
}
In: Computer Science
Write a C program to store the parameters of a circle on a 2D plane: the x and y coordinates of the center point and r, the radius. All three parameters are real (floating point) numbers.
-Define a type to store the parameters of a circle. Write a function that receives the parameters of two circles as function parameters, and returns whether the two circles overlap or not. (Two circles overlap if the distance between their center points - computed by the Pythagorean theorem - is less than the sum of their radius.)
-Write a function that asks the user to enter the parameters of a circle, creates the circle, and returns it.
-Expand the type definition and the functions to a program that reads the data of two circles, decides if they overlap, and displays a message accordingly.
In: Computer Science
Accessing applications in the Cloud is easier than traditional applications, as it can be a matter of just going to a separate website. What are the dangers of this benefit? In a minimum one-page document, discuss this ability and benefit of using Cloud services for applications and where the pitfalls are. Relate your discussion to a specific application type for your comments. Discuss how this may be a benefit or not to a company using the Cloud for its applictions.
In: Computer Science
Use Python programming to find most popular single products and co-purchased products from the large transaction data: retail.csv. Each row in the file is one purchase transaction from a customer, including a set of product ids separated by commas. The first column is transaction ID, column 2-3 are the products ID purchased in this transaction. It is worth mentioning that if the value in third column is zero, it means this customer only purchased one product (the one in second column).
Note:
• Co-purchased products is defined as a pair of products purchased in the same transaction. For example a row is: "2 24 35". Then 24 and 35 is a pair of copurchased products IDs,.
• To find co-purchased product in each transaction, you might use a nested loop.
• Write top 10 single products and top 10 co-purchased product pairs into a new file: output.txt
In: Computer Science
* Python *
* Python Programming *
Part 1: Product Class
Write a class named Product that holds data about an item in a retail store. The class should store the following data in attributes: product id, item description, units in inventory, and price. Write the __init__ method to require all four attributes. Also write a __str__ method for debugging output.
Once you have written the class, write a main() function that creates three Product objects and stores the following data in them. Use the __str__ method to confirm the data is stored properly.
ID
Description
Quantity Price
1
Jacket
12
59.95
2 Designer
Jeans
40
34.95
3
Shirt
20
24.95
Submit your python file (.py) to Sakai
Part 2: Inventory Module
Create an Inventory module by moving the Product Class definition to another file called inventory.py. Add three __doc__ strings: one that describe the inventory module (include your name and the date here), one that describes the Product class, and one that describes the Product class __init__ method.
Rename your main() function to test_inventory.py
Add an import at the top of the file to read the Product class
definition.
Add these print statements to test the __doc__ string:
Print(inventory.__doc__)
Print(Product.__doc__)
Print(Product.__init__..__doc__)
Test the program to be sure it still works. NOTE: If using IDLE, you will have to explicitly save the inventory.py file after making changes.
In: Computer Science
FOR JAVA
Write a method called findNum that takes a two-dimension array of integers and an int as parameters and returns the number of times the integer parameter appears in the array.
For example, if the array (as created by the program below) is
10 45 3 8
2 42
3 21 44
And the integer parameter is 3, the value returned would be 2 (the number 3 appears two times in the array)
public class HomeworkA {
public static void main(String args[]){
int arr[][] = {{10, 45, 3, 8}, {2, 42}, {3, 21, 44}};
System.out.println(“The number time 3 appears is “+findNums(arr,3)); }
public static int findNum (int [][] myArray) {
..........
In: Computer Science
6) Solving for method Newton-Rapson starting from (1,1,1) in matlab (with algorithm)
1) sin(x) + y^2 + ln(z) – 7 = 0
2) 3x + 2^y – z^3 + 1 = 0
3) x + y + z – 5 = 0
In: Computer Science
Write a function named mirror_tree that accepts a pointer to the root of a binary tree of integers. Your function should rearrange the nodes into a mirror tree of the original tree. The mirror tree has the left and right subtrees reversed for each node.
Constraints: You must implement your function recursively and without using loops. Do not construct any new BST objects in solving this problem (though you may create as many NODE* pointer variables as you like). Do not use any auxiliary data structures to solve this problem (no array, vector, stack, queue, string, etc).
Assume that you are using the NODE structure as defined below:
struct NODE {
int Key;
NODE* Left;
NODE* Right;
};
If you run mirror_tree on a BST, is your new tree still a BST?
Code to edit:
/ util.h
#include <iostream>
#include "bst.h"
using namespace std;
// mirror_tree:
//
// Your function should rearrange the nodes into a mirror
tree
// of the original tree. The mirror tree has the left and
right
// subtrees reversed for each node.
//
void mirror_tree(NODE* node) {
// TO DO: Write this function.
}
In: Computer Science
Find the runtime of this function, where n is an integer.
int function(int n) {
int a = 0;
for (int i = n; i > 0; i--) {
for (int j = 0; j < i; j++) {
a = a + i + j;
}
}
return a;
}
Find the runtime of this function, where m and n are two integers.
int f(int m, int n) {
if (m==1 || n==1) {
return 1;
}
return f(m, n-1) + f(m-1, n);
}
Please explain to me each of the steps and how you receive the answer.
Thank you
In: Computer Science