Implement in C++ a game called “Your Lucky Number”. The lucky number is calculated based on an individual’s birth month, day, and year. The algorithm assigns any person a number between 1 and 9. Many people believe that a group of people with the same lucky number share common features. The lucky number is calculated as the sum of digits of the birth month, day, and year numbers. If this sum is not a single digit then you need to keep adding up its digits. Use the C++ functions when you implement the game. Test your program for corrections. To start the game you should enter your full birthdate in the format: month day year, e.g. 9 21 1985. The month is represented by its corresponding integer: January is 1, February is 2, ..., and December is 12. Be sure that your program will verify the input format and print an error message when the format is incorrect (use exceptions), and will ask to re-enter the birthdate again.
The algorithm for calculating the lucky number
(a) Enter the month as an integer from 1 to 12.
(b) Reduce the month, day and year numbers down to a one-digit number by adding all digits in month, day and year numbers, see the example below.
(c) Map the number to the category listed below and display the message on the screen with at least four features for a person in each category. I provided only one feature (as an adjective) for each category and you should complete the list.
(d) Test your program using at least 10 your friends’ or relatives’ birthdays.
(e) Provide statistics in the README file about the results of your testing by giving the percentage of people that confirm that they belong to the category calculated by your program. Write in the README file about what you have learned by writing this assignment. Write also about your (possible) problems, errors or mistakes.
Categories:
1. The Leader: original thinker (add 3 more features)
2. The Mediator: diplomatic (add 3 more features)
3. The Communicator: expressive (add 3 more features)
4. The Teacher: trustworthy (add 3 more features)
5. The Freedom Seeker: adventurous (add 3 more features)
6. The Nurturer: family-oriented (add 3 more features)
7. The Seeker: analytic (add 3 more features)
8. The Power House: authoritative (add 3 more features)
9. The Humanitarian: charitable (add 3 more features)
In: Computer Science
Highway Project Project
The Department of Highways in South Carolina was exploring ways to reduce the road construction costs and developed new contracting processes to allow the road builders to bring new ideas for cutting costs. On one project, the contractor proposed cost-cutting ideas throughout the life of the project. At each phase, the client accepted many of the ideas and then revised the budget. The client promoted the revised cost target of the project as an example of the success of the new process. By the end of the project, the final cost was less than 1 percent over the newest target. Although the total cost of the project was almost 10 percent less than the original cost projections and contract obligations, the success of the project was connected to the new expectations that developed during the life of the project. Even though this project performance exceeded the original goal, the client was disappointed.
Biotech Project
A biotechnology company developed a new drug that proved to have
a large market demand, and the team that developed the drug was
assigned to build a new manufacturing facility to produce the drug.
The project manager for the construction company that was awarded
the contract to build the manufacturing facility managed the
project effectively. Every request for a change in scope was
approved, and the result was a 20 percent increase
to the total cost of the project. On most projects, a 20 percent
increase in the project cost would be considered poor performance.
For the client’s project team, who were accustomed to complex
projects with a large number of unknown issues that increase the
final cost of the project, a 20 percent overrun in cost was not
unusual. Even though the project was 20 percent over budget, the
client was happy. Client satisfaction is often tied to expectations
about project performance. Identifying and managing those
expectations is a primary responsibility of the project
manager.
Discussion
What are the differences between the two projects? Identify the single most important difference between the two projects that affected client satisfaction. Suggest an approach to managing client expectations in the highway project that might have resulted in meeting or exceeding expectations rather than disappointment.
In: Computer Science
I am coding with NetBeans LDE Java.
Write a program that reads a positive integer n , prints all sums from 1 to any integer m 1≤m≤n . For example, if n=100, the output of your program should be
The sum of positive integers from 1 to 1 is 1;
The sum of positive integers from 1 to 2 is 3;
The sum of positive integers from 1 to 3 is 6;
The sum of positive integers from 1 to 4 is 10;
The sum of positive integers from 1 to 5 is 15;
*
*
*
*
The sum of positive integers from 1 to 100 is 5050.
(The program should include a main method, and no tester class is needed)
In: Computer Science
Convert the following hexadecimal representations of 16-bit 2’s complement binary numbers to decimal.
a.FCAD
b.DEAD
c.1111
d.8000
e.FACE
In: Computer Science
write a program in C language
Create a function to perform the insertion sort. Now the program will perform the following steps:
Code snippet:
1. Function Declaration
void displayArray(float *arr, int size); void sortArray(float *arr, int size);
2. Function definition
void displayArray(float *arr, int size){ printf("["); for (int i=0; i<size-1; i++) { printf("%f, ",arr[i]); } printf("%f]\n", arr[size-1]); }
3. Function call/invocation
displayArray(arr, N); sortArray(arr, N);
4. Dynamic memory allocation for array
float *arr = (float*) malloc(N * sizeof(float));
In: Computer Science
You will write a PHP program to calculate the payment
receipt for renting a number of movies, using a
conditional structure.
Suppose that the rental rate depends on the number of movies rented
by a customer at a time. There is a limit of renting a maximum of
20 movies at a time.
Conditions: For the first 2 movies rented, the rate is $5.50/movie.
For the next 2 movies rented, the rate is $4.25/movie. For the next
3 movies rented, the rate is $3.00/movie. For any more movies
rented (no more than 20), the rate is $2.00/movie.
Hence, if a customer rents 5 movies, two of those will be rented at
$5.50, two for $4.25 and one for $3.00, for a total of (2*$5.50) +
(2*$4.25) + $3.00 = $22.50.
1) Create a form that asks the customer for his/her name and the
number of movies he/she would like to rent. On submit, display the
total amount due (shown to 2 decimal places) on the same page. (15
points) 2) Save the customer’s submitted name in a flat file called
“visitor.txt”. You should overwrite this name every time someone
submits a name to the form. (10 points)
Give appropriate error or warning messages for both 1) and
2).
In: Computer Science
Problem 1:
You have two sorted lists of integers, L1 and L2. You know the lengths of each list, L1 has length N1 and L2 has length N2.
Design a linear running time complexity algorithm (ONLY PSEUDOCODE) to output a sorted list L1 ∧ L2 (the intersection of L1 and L2).
Important Notes:
For this problem, you don’t need to submit any implementation in Java. Only the pseudocode of your algorithm is required.
Pseudocode is a simple way of writing programming code in English. It uses short phrases to write code for programs before you actually create it in a specific language.
• Example of pseudocode:
Set total to zero
Set grade counter to one
While grade counter is less than or equal to ten
Input the next grade
Add the grade into the total
Set the class average to the total divided by ten
Print the class average.
Please make sure answer is given in pseudocode
In: Computer Science
Here is an interaction in a tic-tac-toe game, with user input in bold:
>> gm = Game.new('andy', 'mike')
=> #<Game:0x2e91d78 @players=[Andy, Mike]>
>> gm.play_game('mike') Mike, enter your next O O--
---
---
Andy, enter your next X
O-X
---
---
Mike, enter your next O
O-X
-O-
---
Andy, enter your next X move
Bad move dude! You go again.
O-X
-O-
---
Andy, enter your next X move
O-X
-OX
---
Mike, enter your next O move
O-X
-OX
--O
Mike, you won!
=> nil
>> gm.play_game('karen')
I don't know that player. Please try again. => nil
>> gm.play_game('andy')
Andy, enter your next O move (1-9): 5 ---
-O-
---
When a new game is created, two players register with it by name (the arguments to Game.new). The play_game message is called with one of the player’s names and starts a new game where that player plays first using the O marker. (A game can be sent repeated play_game messages so the same pair of players can play multiple games). In each iteration, the current player is prompted for the position of her move and then she enters the move number, where the nine squares are numbered in row-major order from 1 through 9. If a move is illegal (i.e., already occupied), the current player is scolded and prompted again for a move. After each move, the board is redrawn. A game ends when either one of the players forms a horizontal, vertical, or diagonal row of her three markers (in the usual way), or the board is full indicating a tie.
The assignment is not to implement this game in Ruby. Rather, the assignment is to develop sequence diagrams to discover the objects, their responsibilities, and the messages they respond to. Specifically, focus on these two scenarios:
Where the current game is not over, the current player is prompted for a legal move which she supplies and then the move is made and the updated game board is displayed.
A new game is started and then play iterates between the two players until one of the players wins.
Note that the first scenario is lower level than and fits into the second scenario.
In: Computer Science
LINUX/UNIX
Create a script named favcolor.sh.
Take 2 parameters, 1. Username, 2. Favorite color.
Print any sentence on console using these 2 parameters.
In: Computer Science
write a c++ program
. Ask the user to enter a number less than 100. Test the input to make sure it is correct, and use a while loop to continuously ask the user for correct input value if they don't follow the input rule. After receiving the correct input, test the number to see if it is even or odd. If it is odd, use a while loop to do the following: Output to the monitor all odd numbers from 1 to your input value. If the number is even, use a while loop to output to the monitor all the even numbers from 0 to your input value.
In: Computer Science
In: Computer Science
In: Computer Science
In: Computer Science
Compare the algorithms and determine which is the fairest for the next process in the queue. Explain why this algorithm will always be the fairest disk-scheduling algorithm.
Describe an example of circumstances where fairness would be an important goal. Describe a scenario where it would be important that the operating system be unfair. Minimum 250 words.
In: Computer Science
Write a function that tells whether a hailstone sequence contains a number that is greater than 1000.
Write a contract, then an implementation, of a function that takes exactly one parameter, an integer n, and returns true if the hailstone sequence starting with n contains a number that is greater than 1000, and returns false otherwise. The heading must be as follows.
bool bigHailstone(int n)
This function must not read or write anything.
Your algorithm for bigHailstone must be a search algorithm. As soon as it sees a number that is greater than 1000, bigHailstone must return true without looking at any more numbers in the hailstone sequence starting with n.
Modify your main function so that it also shows whether there is a number that is greater than 1000.
In: Computer Science