C Programming:
Problem 1:
Write a function that returns the index of the largest value stored in an array-of- double. Test the function in a simple program
Problem 2:
Write a function that returns the difference between the largest and
smallest elements of an array-of-double. Test the function in a
simple program
In: Computer Science
Design, implement and test a C++ class to work with real numbers as rational numbers called class "Rational". The data members are the numerator and denominator, stored as integers. We have no need for setters or getters (aka mutators or accessors) in the Rational class. All of our operations on rational numbers involve the entired number, not just the numerator or denominator."
Code:
int greatestCommonDivisor(int x, int y) {
while (y != 0) {
int temp = x % y;
x = y;
y = temp;
}
return x;
}
In: Computer Science
Database - Data Modelling || Select Correct Answer:
CUSTOMER (CustomerID, CustomerFName, CustomerLName, CustomerStrNo, CustomerStr, CustomerSuburb, CustomerState, CustomerPostcode, CustomerEmail, PreferredStoreId*)
FD: CustomerID --> CustomerFName, CustomerLName, CustomerStrNo, CustomerStr, CustomerSuburb, CustomerState, CustomerPostcode, CustomerEmail, PreferredStoreId*
This relation is in?
3NF
1NF
2NF
None
In: Computer Science
Pick three questions from the following list and write a thorough 3-5 paragraph response.
1. Explain the primary role and responsibilities of business analysts/system analysts.
2. Describe the need for Business Process Management. What is an AS IS model?
3. Describe the origins of SDLC and how it came to prominence.
4. Explain two reasons why SDLC is falling out of favor.
5. Describe advantages of using Agile methods like Scrum.
6. What are the keys for successful SDLC projects?
7. How can Agile overcome the problems of the SDLC?
8. How do information systems support business processes?
9. Comment on you own experiences with business process improvement and systems development projects you have seen at your employer.
In: Computer Science
Write a C++ program that reads five (or more) cards from the user, then analyzes the cards and prints out the category of hand that they represent.
Poker hands are categorized according to the following labels: Straight flush, four of a kind, full house, straight, flush, three of a kind, two pairs, pair, high card.
To simplify the program we will ignore card suits, and face cards. The values that the user inputs will be integer values from 2 to 9. When your program runs it should start by collecting five integer values from the user and placing the integers into an array that has 5 elements. It might look like this:
Enter five numeric cards, no face cards. Use 2 - 9. Card 1: 8 Card 2: 7 Card 3: 8 Card 4: 2 Card 5: 3
(This is a pair, since there are two eights)
No input validation is required for this assignment. You can assume that the user will always enter valid data (numbers between 2 and 9).
Since we are ignoring card suits there won't be any flushes. Your program should be able to recognize the following hand categories, listed from least valuable to most valuable:
| Hand Type | Description | Example |
| High Card | There are no matching cards, and the hand is not a straight | 2, 5, 3, 8, 7 |
| Pair | Two of the cards are identical | 2, 5, 3, 5, 7 |
| Two Pair | Two different pairs | 2, 5, 3, 5, 3 |
| Three of a kind | Three matching cards | 5, 5, 3, 5, 7 |
| Straight | 5 consecutive cards | 3, 5, 6, 4, 7 |
| Full House | A pair and three of a kind | 5, 7, 5, 7, 7 |
| Four of a kind | Four matching cards | 2, 5, 5, 5, 5 |
(A note on straights: a hand is a straight regardless of the order. So the values 3, 4, 5, 6, 7 represent a straight, but so do the values 7, 4, 5, 6, 3).
Your program should read in five values and then print out the appropriate hand type. If a hand matches more than one description, the program should print out the most valuable hand type.
Here are three sample runs of the program:
Enter five numeric cards, no face cards. Use 2 - 9. Card 1: 8 Card 2: 7 Card 3: 8 Card 4: 2 Card 5: 7 Two Pair!
Enter five numeric cards, no face cards. Use 2 - 9. Card 1: 8 Card 2: 7 Card 3: 4 Card 4: 6 Card 5: 5 Straight!
Enter five numeric cards, no face cards. Use 2 - 9. Card 1: 9 Card 2: 2 Card 3: 3 Card 4: 4 Card 5: 5 High Card!
Additional Requirements
1) You must write a function for each hand type. Each function must accept a const int array that contains five integers, each representing one of the 5 cards in the hand, and must return "true" if the hand contains the cards indicated by the name of the function, "false" if it does not. The functions should have the following signatures.
bool containsPair(const int hand[]) bool containsTwoPair(const int hand[]) bool containsThreeOfaKind(const int hand[]) bool containsStraight(const int hand[]) bool containsFullHouse(const int hand[]) bool containsFourOfaKind(const int hand[])
Note that there are some interesting questions regarding what some of these should return if the hand contains the target hand-type and also contains a higher hand-type. For example, should containsPair() return true for the hand [2, 2, 2, 3, 4]? Should it return true for [2, 2, 3, 3, 4]? [2, 2, 3, 3, 3]? I will leave these decisions up to you.
2) Of course, as a matter of good practice, you should use a constant to represent the number of cards in the hand, and everything in your code should still work if the number of cards in the hand is changed to 4 or 6 or 11 (for example). Writing your code so that it does not easily generalize to more than 5 cards allows you to avoid the objectives of this assignment (such as traversing an array using a loop). If you do this, you will receive a 0 on the assignment.
3) You do not need to write a containsHighCard function. All hands contain a highest card. If you determine that a particular hand is not one of the better hand types, then you know that it is a High Card hand.
4) Do not sort the cards in the hand. Also, do not make a copy of the hand and then sort that.
5) An important objective of this assignment is to have you practice creating excellent decomposition. Don't worry about efficiency on this assignment. Focus on excellent decomposition, which results in readable code.This is one of those programs where you can rush and get it done but end up with code that is really difficult to read, debug, modify, and re-use. If you think about it hard, you can think of really helpful ways in which to combine the tasks that the various functions are performing. 5 extra credit points on this assignment will be awarded based on the following criteria: no function may have nested loops in it. If you need nested loops, the inner loop must be turned into a separate function, hopefully in a way that makes sense and so that the separate function is general enough to be re-used by the other functions. Also, no function other than main() may have more than 5 lines of code. (This is counting declarations, but not counting the function header, blank lines, or lines that have only a curly brace on them.) In my solution I was able to create just 3 helper functions, 2 of which are used repeatedly by the various functions.
These additional criteria are intended as an extra challenge and may be difficult for many of you. If you can't figure it out, give it your best shot, but don't be too discouraged. It's just 5 points. And be sure to study the posted solution carefully.
Suggestions
Test these functions independently. Once you are sure that they all work, the program logic for the complete program will be fairly straightforward.
Here is code that tests a containsPair function:
int main() {
int hand[] = {2, 5, 3, 2, 9};
if (containsPair(hand)) {
cout << "contains a pair" << endl;
}
}In: Computer Science
(I am a beginner in programming, can you give me answers that I can understand? I got some answers which I think are for high level. Thank you)
Q1. Program Description: The program should:
Ask a user to enter some digit (integer) between 1 and 9
Multiply it by 9
Write the output to the screen
Multiply that new number by 12345679 (note the absence of the number 8)
Write that output to the screen.
As shown below, the program should print out the entire multiplication as though you had done it by hand.
Presents the output of two different input other than 5 in the Word doc.
-------------------Sample Screen Output:----------------------
Enter a number from 1 to 9: 5
5
X 9
----------------
45
X 12345679
---------------------
555555555 (ßTo look like this, the last number must be an int.)
Note: Your alignment does not need to be perfect, but should roughly approximate what you see above.
---------------------------------------------------------------------
Q2. Program Description: Write a program that prompts the reader for two integers and then prints:
The sum
The difference (This should be number1 minus number2.)
The product
The average (This should be a double number. with decimal point)
Presents the output of two different input sets in the Word doc.
--------------Sample Screen Output:------------------
Enter number 1: 13
Enter number 2: 20
Original numbers are 13 and 20.
Sum = 33
Difference = -7
Product = 260
Average = 16.5
In: Computer Science
Create a Java program that will encrypt a message and decryted a message and it must be save to a disk file.
In: Computer Science
I'm working on a python programming problem where I have to write a program that plays rock paper scissors.
our program will allow a human user to play Rock, Paper, Scissors with the computer. Each round of the game will have the following structure:
The computer should select the weapon most likely to beat the user, based on the user’s previous choice of weapons. For instance, if the user has selected Paper 3 times but Rock and Scissors only 1 time each, the computer should choose Scissors as the weapon most likely to beat Paper, which is the user’s most frequent choice so far. To accomplish this, your program must keep track of how often the user chooses each weapon. Note that you do not need to remember the order in which the weapons were used. Instead, you simply need to keep a count of how many times the user has selected each weapon (Rock, Paper or Scissors). Your program should then use this playing history (the count of how often each weapon has been selected by the user) to determine if the user currently has a preferred weapon; if so, the computer should select the weapon most likely to beat the user’s preferred weapon. During rounds when the user does not have a single preferred weapon, the computer may select any weapon. For instance, if the user has selected Rock and Paper 3 times each and Scissors only 1 time, or if the user has selected each of the weapons an equal number of times, then there is no single weapon that has been used most frequently by the user; in this case the computer may select any of the weapons.
At the beginning of the game, the user should be prompted for his/her input. The valid choices for input are:
At the beginning of each round your program should ask the user for an input. If the user inputs something other than r, R, p, P, s, S, q or Q, the program should detect the invalid entry and ask the user to make another choice.
Your program should remember the game history (whether the user wins, the computer wins, or the round is tied).
At the end of the game (when the user chooses ‘q’ or ‘Q’), your program should display the following:
In: Computer Science
Hey guys,
I have my assignment due for Coding on next Friday. There were 2 parts of assignment, part 1 was about User Interface (CUI), File I/O, Software Functionality and others without GUI. This includes OOP. Anyways 2nd part of our assignment includes GUI And other advanced features that we have to implement on our previous program. I'm happy to send you the exact details of whats required for assignment 2. Anyways, I've done the first part, and All I'm asking is that would you still take $7.90 NZD because all that's need to be added is GUI. I have about 5 classes I think. So what do you think? My topic is Who Wants To Be A Millionaire! Basic millionaire code!
In: Computer Science
The restaurant maintains the catalog for the list of food and beverage items that it provides. Apart from providing food facility at their own premises, the restaurant takes orders online through their site. Orders on the phone are also entertained. To deliver the orders, we have delivery boys. Each delivery boy is assigned to the specific area code. The delivery boy cannot deliver outside the area which is not assigned to the delivery boy (for every delivery boy there can be a single area assigned to that delivery boy). The customer record is maintained so that premium customer can be awarded discounts.
Need copy of code and a report if possible.
Code is Python.
In: Computer Science
x = [0,1,2,3,4,5,6,7,8];
y = [0,10,23,28,25,13,6,2,-5];
Spline interpolation, Use Matlab code
Write your own spline method to estimate the value of the function
on x ∈ [0,8],Δx = 0.1. For your 2 degrees of freedom, set the first
and second
derivatives at the left boundary to 0. Save your result, the
interpolated y values.(do not use Matlab's built-in spline
method
In: Computer Science
C++ Coding ****** Please read prompt carefully and include screenshots fro verification.
Start with a Person class, and create a multiset to hold pointers to person objects. Define the multiset with the comparePersons function object, so it will be sorted automatically by names of person. Define a half-dozen persons, put them in the multiset, and display its contents. Several of the persons should have the same name, to verify that multiset stores multiple object with the same key. Also allow the user to search a person object by the last name and the first name.
In: Computer Science
JAVA LANGUAGE coding required.
You are to take the payroll file called DeweyCheatemAndHow.txt to use as input to your program and produce a file that lists all the employee and their gross pay. At the end of the file you are to show the average gross pay for each type of employee.
In order to do this, you will need to create the following classes:
Employee:
Attribues:
First name
Last name
Address
Phone
SSN
Methods:
Appropriate constructors
Set methods for first name, last name, ssn
Get methods for last name, first name, ssn, address, phone
toString
Equals
Salaried: (Child of Employee)
Attributes:
Salary
Methods
Appropriate constructors
Set methods for Salary
Get methods for Salary
toString
Pay
Hourly: (Child of Employee)
Attributes:
Pay rate
Hours worked
Methods
Appropriate constructors
Set methods for pay rate, hours worked
Get methods for pay rate, hours worked
toString
Pay
Piece: (Child of Employee)
Attributes:
Quantity
Piece rate
Methods
Appropriate constructors
Set methods for Quantity, Piece rate
Get methods for Quantity, Piece rate
toString
Pay
Each line in the file start with a single letter that represents whether the employee is salaried, hourly or piece rate. The letters are s for salaried, h for hourly and p for piece rate. Below is an example of what each line will look like:
Code ssn first name last name address phone salary
s 123-45-6789 William Tell 1313 Mockingbird lane 513-556-7058 500.75
Code ssn first name last name address phone pay rate hours worked
h 123-45-6789 Scott Tell 1313 Mockingbird lane 513-556-7058 10 40.0
Code ssn first name last name address phone pay per piece number of pieces
p 123-45-6789 Chris Stevens 1313 Mockingbird lane 513-556-7058 7.50 1000
You are to process all the entries provided in the file and produce output that looks like this:
Dewey, Cheatem and How Law Firm
Payroll Report
First Name Last Name SSN Gross Pay $XXX.
First Name Last Name SSN Gross Pay $XXX.
First Name Last Name SSN Gross Pay $XXX.
First Name Last Name SSN Gross Pay $XXX.
First Name Last Name SSN Gross Pay $XXX.
First Name Last Name SSN Gross Pay $XXX.
First Name Last Name SSN Gross Pay $XXX.
.
.
.
Average salaried employee gross pay: $XXX
Average hourly employee gross pay: $XXX
Average pieces employee gross pay: $XXX
Please note that for this assignment you are to use the data in the file below as the source to input into your program but that the inputting is to be handled by your program prompting the user to input the information. The next assignment will address inputting directly from a file.
s 028-13-3948 Andrew Smith 1313 Mockingbird Lane 513-556-7000
500.75
s 028-24-9971 Andrew Whaley 1776 Liberty Ave 513-556-7001 675
h 112-45-7867 Saif Altarouti 3427 Smith Rd 513-556-7002 20 40
s 123-45-6789 Nicholas Alonso 920 Ohio Ave 513-556-7003 900
s 123-94-3938 Abigail Smith 1600 Penn St 513-556-7004 1200
h 123-97-4556 Matthew Stewart 2925 Campus Green 513-556-7005 16.5
40
s 142-78-2367 Syeda Mullen 345 Ludlow Ave 513-556-7006 763
p 143-49-0923 Arianna Rhine 768 Stratford Dr 513-556-7007 7.5
1000
p 193-93-1283 Emmalese Nuerge 132 Greyfox Rd 513-556-7008 8.5
1010
p 211-54-823 Joshua Ayers 671 Buckwheat Rd 513-556-7009 5.5
500
h 258-29-9102 Nicholas Roth 734 Student Dr 513-556-7010 25 35
In: Computer Science
2 Builder Pattern
java
-set up builder pattern to run this
RobotBuilder builder = new RobotBuilder();
builder.setRam(1000);
builder.setStorage(10000);
builder.setWheels(2);
builder.setName("Robo Ron");
Robot robot = builder.build();
builder = new RobotBuilder();
builder.setName("Robo Rene");
builder.setRam(500);
builder.setStorage(15000);
Robot robot2 = builder.build();
In: Computer Science
This is meant to be done in C. Write a program using putchar() and getchar() that reads characters form the keyboard and write to the screen. Every letter that is read should be written three times and followed by a newline. Any newline that is read should be disregarded. All other characters should just be copied to the screen.
I am stuck on this any help please?
In: Computer Science