This exercise allows a user to enter the values of two, 3x3 matrices and then select from options including, addition, subtraction, matrix multiplication, and element by element multiplication. You should use numpy.matmul() for matrix multiplication (e.g. np.matmul(a, b) ). The program should computer the appropriate results and return the results, the transpose of the results, the mean of the rows for the results, and the mean of the columns for the results. When entering data you should check that each value is numeric for the matrices. The user interface should continue to run until the user indicates they are ready to exit.
If an inappropriate entry is detected, the program should prompt for a correct value and continue to do so until a correct value is entered. Hints: 1. Use numpy and associated functionality 2. Create and use functions as often as possible 3. Use comments to document your code 4. Both integers and float values are acceptable
In: Computer Science
Write a program named CheckMonth2 that prompts a user to enter a birth month and day.
Display an error message that says Invalid date if the month is invalid (not 1 through 12) or the day is invalid for the month (for example, not between 1 and 31 for January or between 1 and 29 for February).
If the month and day are valid, display them with a message. For
example, if the month entered is 2, and the day entered is 17, the
output should be 2/17 is a valid birthday.
This is the code i start with. (Answer is C# Please.)
using System;
using static System.Console;
class CheckMonth2
{
static void Main()
{
// Write your main here
}
}
In: Computer Science
Write functions:
i) One that prompts a user for 2 numbers.
ii) Adds the two numbers if they are even
iii) Multiplies the two numbers if they are odd
iv) Displays the appropriate output to the user
You are writing 4 functions and calling them to test functionality.
RUN in IDLE
In: Computer Science
Introduction to Database SHort answer question
-1)Can intersection data be placed in the entity box of one of the two entities in the many-to-many binary relationship? If yes, describe which one. If not, where can you put it? Explain.
-2)What is the difference between a record type and an occurrence of that record? Explain and give example(s).
-3)Name at least 4 entities, some sample attributes for each entity, and the primary key field for each entity, in a university environment .
4)How foreign key is used to set-up one-to-many relationships in relational databases? Explain and give example (example from the lecture is ok).
5) How to implement Many-to-Many relationship in a relational Database? Explain and give example (example from the lecture is ok)
6)Describe referential integrity problem in general. In the specific case of deleting a record in a table on the “one side” of a one-to-many relationship, how would referential integrity occur?
In: Computer Science
Which of the following statements is false?
| a. |
UML represents instance variables as an attribute name, followed by a colon and the type |
|
| b. |
Private attributes are preceded by the keyword private in the UML |
|
| c. |
In the UML, each class is modeled in a class diagram as a rectangle with three compartments. The top one contains the class’s name centered horizontally in boldface. The middle one contains the class’s attributes, which correspond to instance variables in Java. The bottom one contains the class’s operations, which correspond to methods and constructors in Java |
|
| d. |
The UML models operations by listing the operation name followed by a set of parentheses. A plus sign (+) in front of the operation name indicates that the operation is a public |
In: Computer Science
. Create a Python function that asks the user for a number (integer). The function should then tell the user how many hundreds can go into the number, and how much is left over.
Hint: the % operator calculates the remainder of a division. For example, 10 % 3 gives a result 1.
Hint2: Deal with the positive and negative values in separate parts of an if-else structure. Get the calculation work for positive values first. For negative values, make them positive (num = -num) and then use the same method as for positive values, adapting as
this is a python program so i need your help to complete this task. as i have to submit it by tomorrow.
thanks
In: Computer Science
Exercise #1:
Create an abstract class called GameTester. The GameTester class includes a name for the game tester and a boolean value representing the status (full-time, part-time).
Include an abstract method to determine the salary, with full-time game testers getting a base salary of $3000 and part-time game testers getting $20 per hour.
Create two subclasses called FullTimeGameTester, PartTimeGameTester. Create a console application that demonstrates how to create objects of both subclasses. Allow the user to choose game tester type and enter the number of hours for the part-time testers.
Exercise #2:
CityToronto bank provides mortgages for individuals and businesses up to $300,000. Write a Java application that keeps track of mortgages and computes the total amount owed at any time (mortgage amount + interest).
Design the following classes to implement your application:
Mortgage – an abstract class that implements the MortgageConstants interface. A Mortgage includes a mortgage number, customer name, amount of mortgage, interest rate, and term.
Don’t allow mortgage amounts over $300,000. Force any mortgage term that is not defined in the MortgageConstants interface to a short-term, one year loan. Create a getMortgageInfo method to display all the mortgage data.
MortgageConstants – includes constant values for short-term (one year), medium-term (three years) and long-term (5 years) mortgages. It also contains constants for bank name and the maximum mortgage amount.
BusinessMortgage – extends Mortgage. Its constructor sets the interest rate to 1% over the current prime rate.
PersonalMortgage - extends Mortgage. Its constructor sets the interest rate to 2% over the current prime rate.
ProcessMortgage – a main class that create an array of 3 mortgages. Prompt the user for the current interest rate. Then in a loop prompts the user for a mortgage type and all relevant information for that mortgage. Store the created Mortgage objects in the array. When data entry is complete, display all mortgages.
In: Computer Science
Draw a single graph in Python showing the performance of both a linear and binary search algorithm against the number of elements (100,000). Consider the worst case scenario. In the graph we want to see: labeling of the axes, a legend, a title and the graphs for both linear and binary search, again correctly labeled. Explain what you see. Hint: Use Plot Functions (Plot Chart, series from functions) from the H!de Editor.
In: Computer Science
This assignment is one program demonstrating IF statements and Decisions in C++ format.
Program 2 People eating at a restaurant get to eat for free if they are younger than 10, pay full price if they are under 65, get a $3 discount if they are 65 or over. Write a program asking the user for an age of the next customer and the price of the food they ordered. Calculate how much to charge based on the price (set to 0, full price, or with a discount) along with a 15% tip. Then have the program show this amount to the user. Examples: What age is the person 5 What price is the meal 10 The charge for this person is 0 (a second program run) What age is the person 70 What price is the meal 10 The charge for this person is 8.05
In: Computer Science
(1) T(n)=9⋅T(n3)+n2⋅(log(n))2
(2) T(n) = 10 * T(n/3) + n^2
One of these can be solved using the Master Theorem; the other cannot.
In: Computer Science
In: Computer Science
Thanks in advance.
In Java.
I'm having an issue with one of my methods.
Ex:
The array being pass in is a character array with element: w, ' ', K, Q, k, q, ' ', -, ' ', 0, ' ', 1
public class Find
{
public void enPassant(char[] array)
{
for(int i = 0; i < array.length; ++i)
{
if(array[i] == 'e')
{
count = i;
}
else
{
count += 0;
}
}
if(count > 0)
{
System.out.println("En passant: " + array[count] + array[count +
1]);
}
if(count == 0)
{
System.out.println("En passant: none");
}
}
public class Main
{
public static void main(String[] args)
{
Find testDetail = new Find();
testDetail.enPassant(detailArray);
}
}
Output: Enpassant: kq
My intended output is: Enpassant: none
Why am i getting kq, and what can i do to correct my mistake?
In: Computer Science
In C++ Design and implement a program (name it ProcessGrades) that reads from the user four integer values between 0 and 100, representing grades. The program then, on separate lines, prints out the entered grades followed by the highest grade, lowest grade, and averages of all four grades. Format the outputs following the sample runs below.
In: Computer Science
JAVA CODE_
Use menu based functionality and validation loops to create a new customer bonus fruit package application for the Dirt to Dish discount produce company.
The program you create will prompt the user to enter a number to select one of three bonus pack options:
1 for Apple pack
2 for Orange pack
3 for Banana pack
**Use input validation to ensure a valid option has been
selected before proceeding.
Use variables to keep track of how many of each fruit a customer will have depending on which bonus pack has been chosen. The amount of fruit per bonus pack is given as follows:
Banana pack: 5 bananas, 2 apples, 2 oranges
Orange pack: 5 oranges, 2 apples, 2 bananas
Apple pack: 5 apples, 2 bananas, 2 oranges
Use menu based functionality and input validation and prompt the user to choose from one of the following recipes:
1. Fruit medley (2 of each fruit)
2. Mixed Apple Pie (3 apples, 1 orange, 1 banana)
3. Banana tower (4 bananas, 2 oranges)
The amount of fruit required for each recipe is shown in
parenthesis.
After a valid recipe choice has been made, subtract the amount of fruit needed for the recipe if the customer has enough fruit. If the customer does not have enough fruit then show a message telling the customer to buy more fruits.
Finally display the amount of fruit remaining from the bonus pack after the recipe selection has been made.
First example run:
This is Dirt to Dish's new customer bonus service! Please select your free fruit package: 1. Apple pack 2. Orange pack 3. Banana pack Please enter 1, 2, or 3: 2 You have chosen: Orange pack You have a total of: 2 apples 5 oranges 2 bananas Which dish would you like to make first? 1. Fruit medley (2 of each fruit) 2. Mixed Apple Pie (3apples, 1 orange, 1 banana 3. Banana tower (4 bananas, 2 oranges Please enter 1, 2, or 3: 2 Mixed Apple Pie chosen Sorry, you need more fruits! The fruit you have left is: 2 apples 5 oranges 2 bananas Thank you!
In: Computer Science
Create a 32-bit Linux-based assembler language program (nasm) which:
1. Defines these variables:
A: A single byte
B: A word
C: A double word
D: A double word
2. Using the eax register (and its sub-registers), process the following equations (ONLY using the mov, add and sub assembly keywords):
I. A + (B + C) = D
II. (A + C) - B = D
3. Using the linux function library, print a string describing each equation, then values in each variable, and then the answer in the resulting variable
4.Use the following values in your equation:
I. 10h
II. 2000h
III. 30000
Sample Output: The Result of A + (B + C) = D is: 32010
When printing out a string in NASM, use the linux function library call PrintString. Make sure your string is 00h terminated. • When printing out a Hexadecimal value in NASM, use the linux function library call Print32bitNumHex
In: Computer Science