Provide immediate feedback for each mistyped sentence. To do so, modify the Test class’s present_test method so that it informs the player a mistake has been made, then display the challenge sentence followed by the player’s sentence so the player can determine where the error lies.
#--------------------------------------------------------------------------
#
# Script Name: TypingChallenge.rb
# Version: 1.0
# Author: Jerry Lee Ford, Jr.
# Date: March 2010
#
# Description: This Ruby script demonstrates how to apply conditional logic
# in order to analyze user input and control script execution
# through the development of a computer typing test that
# evaluates the player's typing skills.
#
#--------------------------------------------------------------------------
# Define custom classes ---------------------------------------------------
#Define a class representing the console window
class Screen
def cls #Define a method that clears the display area
puts ("\n" * 25) #Scroll the screen 25 times
puts "\a" #Make a little noise to get the player's attention
end
def pause #Define a method that pauses the display area
STDIN.gets #Execute the STDIN class's gets method to pause script
#execution until the player presses the Enter key
end
end
#Define a class representing the typing test
class Test
#This method displays the 8-ball greeting message
def display_greeting
Console_Screen.cls #Clear the display area
#Display a welcome screen
print "\t\t Welcome to the Ruby Typing Challenge game!" +
"\n\n\n\n\n\n\n\n\n\n\n\n\nPress Enter to " +
"continue. \n\n: "
Console_Screen.pause #Pause the game
end
#Define a method to be used to present test instructions
def display_instructions
Console_Screen.cls #Clear the display area
puts "\t\t\tInstructions:\n\n" #Display a heading
#Display the game's instructions
puts %Q{ This test consists of a series of 10 typing challenges.
The challenge sentences are presented one at a time. To respond
correctly, you must retype each sentence exactly as shown and press
the Enter key. Your grade will be displayed at the end of the test.
\n\n
Grading format: 9 or better sentences typed correctly will result in an 'A',
8 sentences typed correctly will result in a 'B',
7 sentences typed correctly will result in a 'C',
6 sentences typed correctly will result in a 'D',
less than 6 will result in an 'F'!
\n\n\n\n\n\n\n\n\n
Press Enter to continue.\n\n}
Console_Screen.pause #Pause the game
end
#Define a method to be used to present typing challenges
def present_test(challenge)
Console_Screen.cls #Clear the display area
print challenge + "\n\n: " #Display the challenge sentence
result = STDIN.gets #Collect the player's input
result.chop! #Remove the end of line marker
#Analyze the player input and see if it is correct
if challenge == result then
#Keep track of the number of correctly retyped challenge sentences
$noRight += 1
Console_Screen.cls #Clear the display area
#Keep the player informed
print "Correct!\n\nPress Enter to continue."
Console_Screen.pause #Pause the game
else
Console_Screen.cls #Clear the display area
#Keep the player informed
print "Incorrect!\n\nPress Enter to continue."
Console_Screen.pause #Clear the game
end
end
#Define a method to be used to display test results
def determine_grade
Console_Screen.cls #Clear the display area
#To pass the test the player must correctly retype 6 sentences
if $noRight >= 6 then
#Inform the player of the good news
print "You retyped " + $noRight.to_s + " sentence(s) correctly. "
puts "You have passed the typing test!\n\nPress Enter to continue."
else #The player has failed the test
#Inform the player of the bad news
print "You retyped " + $noRight.to_s + " sentence(s) correctly. "
puts "You have failed the typing test!\n\nPress Enter to continue."
end
# Grading Sytem for the Challenge
letter Grade = case $noRight
when 9..10 then "A"
when 8 then "B"
when 7 then "C"
when 6 then "D"
else "F"
end
end
# Main Script Logic -------------------------------------------------------
#Initialize global variable that will be used to keep track of the number
#of correctly retyped sentences
$noRight = 0
Console_Screen = Screen.new #Instantiate a new Screen object
Typing_Test = Test.new #Instantiate a new Test object
#Execute the Test object's display_greeting method
Typing_Test.display_greeting
#Execute the Screen object's cls method in order to clear the screen
Console_Screen.cls
#Prompt the player for permission to begin the test
print "Would you like to test your typing skills? (y/n)\n\n: "
answer = STDIN.gets #Collect the player's response
answer.chop! #Remove any extra characters appended to the string
#Loop until the player enters y or n and do not accept any other input.
until answer == "y" || answer == "n"
Console_Screen.cls #Clear the display area
#Prompt the player for permission to begin the test
print "Would you like to test your typing skills? (y/n)\n\n: "
answer = STDIN.gets #Collect the player's response
answer.chop! #Remove any extra characters appended to the string
end
#Analyze the player's response
if answer == "n" #See if the player elected not to play
Console_Screen.cls #Clear the display area
#Invite the player to return and play again
puts "Okay, perhaps another time.\n\n"
else #The player wants to take the test
#Execute the Test object's display_instructions method
Typing_Test.display_instructions
#Display typing challenges and grade each answer by calling on the
#Test object's present_test method
Typing_Test.present_test "In the end there can be only one."
Typing_Test.present_test "Once a great plague swept across the land."
Typing_Test.present_test "Welcome to Ruby Principles of Ruby Programming"
Typing_Test.present_test "There are very few problems in the world " +
"that enough M&Ms cannot fix."
Typing_Test.present_test "Perhaps today is a good day to die. Fight " +
"beside me and let us die together."
Typing_Test.present_test "Don't cry because it's over, smile because it happened"
Typing_Test.present_test "Be yourself; everyone else is already taken."
Typing_Test.present_test "So many books, so little time."
Typing_Test.present_test "A room without books is like a body without a soul."
Typing_Test.present_test "You know you're in love when you can't fall asleep because reality is finally better than your dreams."
#Notify the player of the results by executing the Test object's
#display_instructions method
Typing_Test.determine_grade
Console_Screen.pause #Pause the game
Console_Screen.cls #Clear the display area
#Thank the player for taking the typing test
puts "Thank you for taking the Ruby Typing Challenge.\n\n"
end
In: Computer Science
Westerville Company reported the following results from last year’s operations: |
Sales | $ | 1,000,000 |
Variable expenses | 300,000 | |
Contribution margin | 700,000 | |
Fixed expenses | 500,000 | |
Net operating income | $ | 200,000 |
Average operating assets | $ | 625,000 |
This year, the company has a $120,000 investment opportunity with the following cost and revenue characteristics: |
Sales | $ | 200,000 | |
Contribution margin ratio | 60 | % of sales | |
Fixed expenses | $ | 90,000 | |
The company’s minimum required rate of return is
15%. |
13. |
If the company pursues the investment opportunity and otherwise performs the same as last year, what residual income will it earn this year? |
In: Accounting
The migration of applications to ATN’s new PaaS platform was successful, but also raised a number of new concerns pertaining to the responsiveness and availability of PaaS-hosted IT resource. ATN intends to move more applications to a PaaS platform, but decides to do so by establishing a second PaaS environment with a different cloud provider. This will allow them to compare cloud providers during a three month assessment period. Discuss on what different features the organization will consider when planning to make a comparison
In: Computer Science
Write a Python program that has a list of 5 numbers [2, 3, 4, 5, 6). Print the first 3 elements from the list using slice expression. a. Extend this program in a manner that the elements in the list are changed to (6, 9, 12, 15, 18) that means each element is times 3 of the previous value. b. Extend your program to display the min and max value in the list.
In: Computer Science
In: Economics
Answer all parts of question 1.
1a.) Find the limits, as t approaches both positive infinity and negative infinity, of the solution Φ(t) of the ivp x' = (x+2)(1-x^4), x(0) = 0
1b.) Find the value of a such that the existence and uniqueness theorem applies to the ivp x' = (3/2)((|x|)^(1/3)), x(0) = a.
1c.) Explain why x' + ((sin(t)) / ((e^t) + 1)) * x = 0 cannot have a solution x(t) such that x(1) = 1 and x(2) = -1.
In: Advanced Math
Hi, can you answer this question in more detail?
Subject: Business Policy and Strategy
The G2000 Group was founded by Michael Tien in 1980 in Hong Kong. The label G2000, first introduced in 1985, was positioned as a specialty clothing chain distributing fashionable men’s and women’s career wear. Today, the G2000 Group is a multi-brand specialty retailer offering an assortment of men’s and women’s apparel and accessories, operating under different labels: G2000 MAN, G2000 WOMAN, G2000 studio, BLAACK and At Twenty.
1.
As for the situation analysis of G2000 company, it involves the following topics, shows your theoretical understanding, and uses Porter's 5 forces to analyze the external environment for the local market of Hong Kong.
(Words: 700)
• Threat of new entrants
In: Operations Management
use money supply and money demand model to show how a decrease in money supply shifts lm curve
In: Economics
One can find out date of the month when someone was born by asking five questions. Each question asks whether the day is in one of the five sets of numbers below
1 3 5 7 2 3 6 7 4 5 6 7 8 9 10 11 16 17 18 19
9 11 13 15 10 11 14 15 12 13 14 15 12 13 14 15 20 21 22 23
17 19 21 23 18 19 22 23 20 21 22 23 24 25 26 27 24 25 26 27
25 27 29 31 26 27 30 31 28 29 30 31 28 29 30 31 28 29 30 31
Set1 Set 2 Set 3 Set 4 Set 5
The birthday is the sum of the first numbers in the set where the day appears. For example, if the birthday is 19, it appears in Set 1, Set 2, and Set 5.
The first numbers in these three sets are 1, 2, and 16 whose sum is 19.
Write a C++ program using arrays that prompts the user to answer whether the day is in Sets 1‐5. If the number is in the particular set, the program adds the first number in the sets to calculate the day of the month. An array must be used in the problem. Refer to the sample output below.
Sample Run:
Is your birthday in Set 1?
1 3 5 7
9 11 13 15
17 19 21 23
25 27 29 31
Enter 0 for No and 1 for Yes: 1
Is your birthday in Set 2?
2 3 6 7
10 11 14 15
18 19 22 23
26 27 30 31
Enter 0 for No and 1 for Yes: 1
Is your birthday in Set 3?
4 5 6 7
12 13 14 15
20 21 22 23
28 29 30 31
Enter 0 for No and 1 for Yes: 1
Is your birthday in Set 4?
8 9 10 11
12 13 14 15
24 25 26 27
28 29 30 31
Enter 0 for No and 1 for Yes: 0
Is your birthday in Set 5?
16 17 18 19
20 21 22 23
24 25 26 27
28 29 30 31
Enter 0 for No and 1 for Yes: 0
Your birthday is on day: 7
In: Computer Science
Consider the case of a small open economy with a fixed exchange rate, perfect capital mobility (i.e., interest parity holds), and complete price stability (no ongoing inflation). Explain what effect a decrease in the world interest rate would have on the following domestic macroeconomic variables:
a. The stock of foreign exchange reserves. b. The money
supply.
c. Real GDP.
d. The price level.
e. The real exchange rate.
In: Economics
Comprehensive Master (Operating) Budget
Bee Gee Distributors, a wholesale company, is considering whether to open a new distribution center near Bowling Green, Ohio. The center would open January 1, 2020. The economic outlook is reasonable, but extensive advance planning is required if such a commitment is to be made. As a part of the planning process, The Board of Directors requires a Master (i.e. Operating) Budgetfor the center’s first quarter of operations(i.e. January, February & March of 2020). In order to prepare anybudget, management must make reasonable assumptions about expected sales, inventory levels and cash flows.
SALES BUDGET: “What is the Profit Plan?”
** It all starts with a sales forecast **
a. January sales are estimated to be $400,000 of which $100,000 (25%) will be cash and $300,000 will be on credit. Management expects the above sales pattern to continue with an overall grow rate of 10% per month. Prepare a sales budget.
b. The company expects to collect 100% of the accounts receivable in the month following the month of the sale. Prepare a schedule of expected cash receipts.
c. Use the information developed above in requirements a and bto determine the amount of accounts receivable on the March 31 pro forma balance sheet and the amount of sales on the first quarter pro forma income statement.
_____________________________________________________________________
PURCHASES BUDGET: “What are our total needs, less what do we have”?
d. Cost of goods sold will be 60% of sales. Company policy is to budget an ending inventory balance equal to 25% of the next month’s projected cost of goods sold. Prepare an inventory purchases budget.
Note: For March analysis needs, Aprilcost of goods sold is expected to be $314,000.
e. All inventory purchases are on account. The company pays 70% of accounts payable in the month of purchase. It pays the remaining 30% in the following month. Prepare a schedule of expected cash payments for inventory purchases.
f. Use the information developed above in requirements d and eto determine the amount of cost of goods sold on the first quarter pro forma income statement and the amounts of ending inventory and accounts payable on the March 31 pro forma balance sheet.
ADMINISTRATIVE & SALES EXPENSE BUDGET:
g. Budgeted monthly selling and administrative expenses are:
Salary Expense |
$24,000 |
Sales Commissions |
5% of Sales |
Supplies Expense |
2% of Sales |
Utilities |
$ 1,400 |
Depreciation on New Equipment (see note below*) |
? |
Rent |
$ 3,600 |
Miscellaneous |
$ 900 |
*The capital expenditures budget shows that Bee Gee must purchase $100,000 of equipment on January 1 to establish the new center. Since the equipment supplier allows a thirty-day trial period, assume Bee Gee will pay for the equipment in January (i.e. by 1/31). Using Straight-line depreciation, the equipment is expected to have a 10-year useful life and a $10,000 salvage value.
SELLING AND ADMINISTRATIVE EXPENSE BUDGET:
h. Sales commissions and utilities are paid in the month after the month in which they are incurred. All other expenses are paid in the month in which they are incurred. Prepare a schedule of cash payments for selling and administrative expenses.
Please do E,F,G,H
In: Accounting
Based on the data bellow, answer questions A and B:
2006
Cash in Circulation: $800B
Bank reserves: $20B
Checkable Deposits: $600B
M1 Velocity: 10.2
Real GDP: $14,602B
2017
Cash in Circulation: $1,460B
Bank reserves: $2,317
Checkable Deposits: $1,985B
M1 Velocity: 5.6
Real GDP: $16,872B
a) Calculate the average annual percentage growth M1, Velocity, and real GDP from 2006 to 2017.
b) Calculate the annual inflation that that should be expected from 2006 to 2017.
In: Economics
Find a current event related to global business, and write a two paragraph summary.
Provide a link to the article on here.
In: Economics
Assuming an economy is operating in a recession and the government wants to conduct an expansionary policy, but does not want to change interest rates or incur any more fiscal debt, discuss what policies are available to the government?
In: Economics
(Using C++ create a Car Instrument Simulator)
Car Instrument Simulator
Create the following classes: Car, Odometer, FuelGauge.
The Car class allows for the instantiation of a Car object.
The Car object will contain (via composition) an Odometer object, and a FuelGauge object.
The Car object will also include "make", "model", and "color" as string properties (instance variables).
In the Car constructor method, you will create a FuelGauge object, passing 15 as an argument into the FuelGauge constructor indicating the number of gallons.
In the Car constructor method, you will create an Odometer object, passing 0 and the address of the FuelGauge object as arguments to the Odometer constructor, indicating the number of miles driven and the address of the FuelGauge object respectively.
The Car class will have a "drive(int miles)" method.
The Odometer object will contain a pointer to a FuelGauge object.
The Odometer object will contain a "milesDriven" instance variable.
The Odometer object will have an "incrementMileage()" method.
The implementation of the Odometer incrementMileage method will
be such that if the fuel level is greater than zero, the Odometer
increments its mileage instance variable by 1. Also, at every
interval of GAS_MILEAGE (a constant that specifies the miles per
gallon), and if the FuelGauge's fuelLevel is greater than zero, the
Odometer will call the decreaseFuelLevel() method on the FuelGauge
object.
The FuelGauge object will have a "decreaseFuelLevel()" method.
The FuelGauge object will contain a "fuelLevel" instance variable.The FuelGauge object will have a "getFuelLevel()" method that returns the current value of the fuelLevel instance variable.
The FuelGauge object will have a "decreaseFuelLevel(int gallons)" method.
The implementation of the FuelGauge decreaseFuelLevel method will be such that the FuelGauge decrements the fuelLevel instance variable by the specified number of gallons. Do not decrease the fuelLevel to a negative value.
The implementation of the Car "drive(int miles)" method will be such that it has a loop wherein...
while you've driven less then the number of miles specified by the
"drive" method parameter value (make it 500) and the fuel level is
greater than zero,call the incrementMileage method on the Odometer
object.
When the car stops driving because it has run out of fuel, display
the number of miles driven.
Deliverables:
7 files: a .h file for each class, a .cpp file for each class, and one .cpp file for your main function.
In: Computer Science