Build a simple “English Language” calculator that does the following:
● Takes three inputs from the keyboard
● Two of the inputs are single-digit numbers (0 to 9)
● The third input is a char from the keyboard, representing one of the five operations from the keyboard:
○ + (addition)
○ - (subtraction)
○ * (multiplication)
○ / (division)
○ ^ (exponentiation)
● Output the description of the operation in plain English, as well as the numeric result
Write a program that reads a web address (for instance, www.yahoo.com) from the keyboard and outputs whether this web address is for a government, a university, a business, a non-profit organization, or another entity.
● If the web address ends with gov, it is a government web address.
● If the web address ends with edu, it is a university web address.
● If the web address ends with com, it is a business web address.
● If the web address ends with org, it is a non-profit organization’s web address.
Otherwise, it is a web address for another entity
Find an optimal parenthesization of a matrix-chain product whose sequence of dimensions is as follows:
Matrix Dimension
A1 10 × 15
A2 15 × 25
A3 25 × 8
A4 8 × 13
A5 13 × 10
Sort the given sequence of numbers using Bubble sort. Write all the
steps involved. 13, 15, 2, 6, 14, 10, 8, 7, 3, 5, 19, 4.
Find an optimal solution for the knapsack instance n=6 and M=13,
(p1 , p2 ,..., p6 )=(8, 5, 13, 7, 6, 15)
(w1 , w2 ,..., w6 )=(3, 2, 4, 6, 2, 5)
1. Create a 'for' loop that will display numbers: 100 90 80 70 60
2. Create a 'for' loop that will display all EVEN numbers from 1 to N. (N is a positive number entered by the user.)
3. Create a 'while' loop that will accept numbers but stops when it encounters a negative number.
While dealing with the negative edge weights, the Dijkstra’s algorithm is not considered best. Explain the alternate suitable algorithm for single source shortest path with an example.
Using the Rabin Karp algorithm, find the pattern string in the given text. Pattern: “fed”, Text: “acfeddadfdec”. Write all the steps involved.
Write an assembly program using MARIE's assembly Instruction set that prompts the user to enter a non-negative integer that is less than 10. The program should include a subroutine that keeps prompting until a valid value is obtained. When a valid number is entered, it will be displayed. (Hint: Use JNS & JUMPI instructions to implement the subroutine) N.B: You should include the MARIE code in your Answer, with an explanation of each instruction in your code beside it (not a screenshot!). Example: Subt One /Subtract 1 from AC Your included code should be ready to be tested by your instructo
(a) Create a class named Invoice containing fields for an item number, name, quantity, price, and total cost. Create a constructor to pass the value of the item name, quantity, and price. Also include displayLine() method that calculates the total cost for the item (As price times quantity) then displays the item number, name, quantity price, and total cost. Save the class as Invoice.java.
(b) Create a class named TestInvoice whose main() method declares three invoice items. Provide values for each, and display them. Save the application as TestInvoice.java.