[solved] – Question 94916
Problem Statement:
Take user input for 2 numbers (num1 and num2). Write a program to perform the following operations:
Add = num1 + num2
Subtract = num1 – num2
Divide = num1 / num2
Modulus = num1 / num2
Multiply = num1 * num2
Find the greater of the 2 numbers, unless both numbers are equal (where you can display “numbers are equal”).
Note:
If a user enters a non-numeric entry (for any of the 2 numbers), exit the program with a message “Incorrect input, program exiting!!” displayed on screen.
The program should be able to accept any (both whole number and/or decimal, positive, negative etc.) numeric entries.
If one or more operations are not (mathematically) possible on the 2 numbers (e.g. 0/0), display a message, on screen, for the operation/operation(s), e.g. “Division – Operation not possible.”
Expert Answer
[solved] – Question 94935
use a while loop that finds the x3 where x = 20…10 (use the order
from 20 to 10 and not 10 to 20)
Expert Answer
[solved] – Question 94951
Write a one-line program to output the following haiku.
A lightning flash:
between the forest trees
I have seen water.
– Shiki
Expert Answer
[solved] – Question 94953
Write a Person class with an instance variable age , and a constructor that takes an integer,initialAge , as a parameter. The constructor must assign initialAge to age after confirming the argument passed as initialAge is not negative; if a negative argument is passed as initialAge, the constructor should set age to 0 and print Age is not valid, setting age to 0.. In addition, you must write the following instance methods:
yearPasses() should increase the age instance variable by 1.
amIOld() should perform the following conditional actions:
If age<13, print You are young..
If age>=13 and age<18, print You are a teenager..
Otherwise, print You are old.
Expert Answer
[solved] – Question 95003
1.Draw a DFA for each of the following (here, ∑ = {0,1}):
a.Set of all non-empty strings.
b.Set of all strings that do not contain the substring 1010.
c.Set of all strings that are at least of length 4 and contain even number of 1’s.
d.Set of all strings that do not end with 11.
e.Set of all strings with at most one consecutive pair of 1’s.
f.Set of all strings that have an odd number of 1’s and any number of 0’s.
g.For Σ = {a, b, c}, all strings with aab as a substring.
h.For Σ = {a, b}, all strings with aababb as a substring.
Expert Answer
[solved] – Question 95083
For the relations s and r in your study manual of our chapter 2 (i.e., joining two relations),
suppose we type a collection of relational algebra queries, and get the following results.
A B C D E
A 2 a 10 B
b 2 a 10 b
Please explain how this happened? If you think this result could happen in practice, please write the
corresponding relational algebra queries; otherwise, please explain why.
Expert Answer
[solved] – Question 95101
• void loadFile(string) – Given a filename, create the corresponding maze. Print the
following message to cout: “Loading level file <level>”, where <level> is replaced
by the filename. You need to populate two arrays: char** map and Entity** entities.
NOTE: if the file cannot be read, throw a FileException. If the maze dimensions given
on the first line of the level text file do not correspond to the provided map, thow a
MapException. Finally, when using pointers, throw NullPointerException where appropriate.
NullPointerException is a lot more informative than a segmentation fault, and
will help you debug your program
void draw() – Draw the map on the screen (cout). Note: the map array provides information
about walls and floors; you must combine this information with the list of entities
stored in the entities array.
Expert Answer
[solved] – Question 95102
Write an application for the Summerdale Condo Sales office; the program determines the price of a condominium. Ask the user to choose 1 for park view, 2 for golf course view, or 3 for lake view. The output is the name of the chosen view as well as the price of the condo. Park view condos are $150,000, condos with golf course views are $170,000, and condos with lake views are $210,000. If the user enters an invalid code, set the price to 0.
Add a prompt to the CondoSales application to ask the user to specify a (1) garage or a (2) parking space, but only if the view selection is valid. Add $5,000 to the price of any condo with a garage. If the parking value is invalid, display an appropriate message and assume that the price is for a condo with no garage.
Expert Answer
[solved] – Question 95127
Write a program that accepts a time as an hour and minute. Add 15 minutes to that time, and output the result.
Expert Answer
[solved] – Question 95138
Write a Python turtle program that computes the sum of 5 numbers entered by the user. Use “For” loop
Expert Answer

