Programming & Computer Science Answers

C++ 9913
Python 5288
Java | JSP | JSF 3611
C 1680
C# 1362
Computer Networks 989
Algorithms 652
Databases | SQL | Oracle | MS Access 641
HTML/JavaScript Web Application 588
Other 537
Visual Basic 358
Assembler 209
Software Engineering 202
AJAX | JavaScript | HTML | PHP 166
MatLAB 150
MatLAB | Mathematica | MathCAD | Maple 124
Action Script | Flash | Flex | ColdFusion 112
UNIX/Linux Programming 89
Web Development 73
Excel 36
ASP | ASP.NET 23
Delphi | Pascal 21
Perl 16
Prolog 9
Functional Programming 9
MathCAD 5
Wolfram Mathematica 4
WPF 4
Ruby | Ruby on Rails 3
NodeJS Web Application 2

Questions answered by Experts: 26 876

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search

Write a Python class named Product which has attributes product_id, product_name,


number of items. Include the constructor and other required methods to set and get the


class attributes. The class should have 2 additional methods to add and remove products


from the inventory. If the number of items for a product in the inventory is less than zero,


the user should be notified with a print message stating, “Product is out of stock”. Create


2 instances of the class and display all its associated attributes.



simple code

please find the question on below link:



https://drive.google.com/file/d/17pfgTzAo5QxJ0K511KVR59WrywFI6iyH/view?usp=sharing

2. Write a Matlab function that accepts a vector of values and returns a vector of derivatives at those points. You can assume that the values are given on an equally spaced array with spacing h. Use the two point central difference formula df dx = fi+1 − fi−1 2h for all points except the two endpoints. For the endpoints use a one-sided derivative that uses two points. The function should have the form


The following C++ program segment computes C = A * B, where A is an “m” by “n”

matrix, B is an “n” by “r” matrix and C is an “m” by “r” matrix.


for (long int i = 0; i < m; i++)

for (long int j = 0; j < r; j++)

{

long double Sum = 0;

for (long int k = 0; k < n; k++)

Sum = Sum + A[i][k] * B[k][j];

C[i][j] = Sum;

}



i) How many times does the code iterate in computing Sum?

ii) How many times does the code iterate in computing the j column of C, i.e. C[i][j] for a fixed i and j = 1, 2, 3, ..., r?

iii) How many times does the code iterate in computing the complete matrix C?


1.     Logs are stacked in a pile with 24 logs on the bottom row and 10 on the top row. There are 15 rows in all with each row having one more log than the one above it. (Use Sn=n/2[2a+(n-1) d])


a)      How many logs are in the stack?




Create class SavingsAccount. Use a static variable annualInterestRate to store the annual

interest rate for all account holders. Each object of the class contains a private instance variable

savingsBalance indicating the amount the saver currently has on deposit. Provide method

calculateMonthlyInterest to calculate the monthly interest by multiplying the

savingsBalance by annualInterestRate divided by 12—this interest should be added to

savingsBalance. Provide a method modifyInterestRate that sets the

annualInterestRate to a new value.

Write a program to test class SavingsAccount. Instantiate two savingsAccount objects, saver1

and saver2, with balances of $2000.00 and $3000.00, respectively. Set annualInterestRate to

4%, then calculate the monthly interest for each of 12 months and print the new balances for both savers.

Next, set the annualInterestRate to 5%, calculate the next month’s interest and print the new

balances for both savers. Also, provide the UML class diagram of your class.


Write a program to print the right alphabet tringle up to the given N rows.



Input



The input be a single line containing a positive integer(N).



Output



The output should bbe N rows with letters.



Note:there is a space after each letter.



Explanation:



For example, if the given number of rows is 4, your code should print the following pattern.



A



A B



A B C



A B C D



Input:



4



Output:



A



A B



A B C



A B C D

Enter·the·first·character:·C

Enter·the·second·character:·c

Enter·the·third·character:·C

Not·Equal


Write a python function Count_Freq(A) which take a dictionary containing numbers. The function will return a dictionary containing key as a number and value as frequency defining how many times the number is repeating in the dictionary.

Example-1

Example-2

Input:

{'V': 10, 'VI': 10, 'VII': 40, 'VIII': 20, 'IX': 70, 'X': 80, 'XI': 40, 'XII': 20}

 

Output:

({10: 2, 40: 2, 20: 2, 70: 1, 80: 1})

Input:

{'V': 10, 'VI': 10, 'VII': 10, 'VIII': 10, 'IX': 20, 'X': 30, 'XI': 40, 'XII': 20}

Output:

({10: 4, 20: 2, 30: 1, 40: 1})



2. Postfix Calculator

by CodeChum Admin

One good implementation of computing infix expressions is to transform them to postfix and then evaluate via the postfix expression.


Infix expressions is the common way of writing arithmetic expressions. The binary operator come between them as shown below:


More info here, Important!

https://pastebin.com/6qLXQ9Md

LATEST TUTORIALS
APPROVED BY CLIENTS