Rewrite the function so the formal parameter x is an IO pointer-to int parameter. The function’s prototype is changed as shown below. Please explain code with comments
//--------------------------------------------------
void NextPrime(int *x)
//--------------------------------------------------
{
bool IsPrime(const int x);
}
In: Computer Science
In: Computer Science
Compare PHP code used to create and update two-dimensional arrays to another programming language. Which is easier and more efficient? Why? Can be compared to any other well used language.
In: Computer Science
Assignment 3-4: IN PYTHON
Guest List: If you could invite anyone to dinner, who would you invite? Make a list that includes at least three people you’d like to invite to dinner. Then use your list to print a message to each person, inviting them to dinner.
---------------------------------------------------------------
Assignment 3-5:
Changing Guest List: You just heard that one of your guests can’t make the dinner, so you need to send out a new set of invitations. You’ll have to think of someone else to invite.
---------------------------------------------------------------
Assignment 3-6:
More Guests: You just found a bigger dinner table, so now more space is available. Think of three more guests to invite to dinner.
---------------------------------------------------------------
Assignment 3-7:
Shrinking Guest List: You just found out that your new dinner table won’t arrive in time for the dinner, and you have space for only two guests.
PreviousNext
In: Computer Science
C++ Please. Break it down barney style if possible.
Instructions
Create a program to keep track of the statistics for a kid’s soccer team. The program will have a structure that defines what data the program will collect for each of the players. The structure will keep the following data:
Players Name (string)
Players Jersey Number (integer)
Points scored by Player (integer)
The program will have an array of 12 players (use less for testing and development, use a constant for the size). Each element in the array is a different player on the team.
The program will ask the user to enter information for each player. The program will also display the team information in a table format. After the table, the total points scored by a team will be displayed.
The program will also determine which player scored the most points on the team.
Validation:
Do not accept negative value for player’s number
Do not accept negative value for player’s score
Required Methods:
void GetPlayerInfo(Player &);
void ShowPlayerInfo(const Player);
int GetTotalPoints(const Player[ ], int);
void ShowHighest(Player [ ], int)
In: Computer Science
In-House, IaaS, or SaaS?
Your organization's current email system is hosted on-premise in a old server that is reaching its end-of-life. Your boss has asked you to replace the existing system
Your boss wants you to research the various options for a new system and is open to hosting it in-house, in the cloud, as a service, or any other solution you may find
Your task:
In: Computer Science
Write a python program to display a menu with the following options: (1) add, (2) subtract, (3) multiply, (4) divide (5) mod, and (6) do nothing. I
f the user enters something else (except 1-6), the program should display an error message.
Otherwise, it should ask the user for two numbers, perform the calculation, and display the result.
In: Computer Science
In Java
Problem 1
Create an Array of your top four vacation spots. Print the first
spot and the last spot in your array.
Problem 2
Create an Array to hold the names of 5 people. Print the first
letter of each of their names.
Problem 3
Create a mini console game that asks for the number of words you
want to enter into an Array. Enter each word and then a letter.
Print out feedback that says "Yep its got one of those" or "Sorry
that letter is not in the word" depending on whether on not the
word entered contains the letter specified.
Stretch Task (Optional)
Create a String representing a list of things that uses some
delimiter (commas,dashes, etc) Split that String into an Array of
Strings, then print each of the Array Elements. You will need to
research (How to Split a String using a Delimiter).
In: Computer Science
Write a Java program in Eclipse to calculate the total cost to enter into a waterpark for a family/group
Ticket rates are listed below
kids (Age 12 and under)=$ 12.50
Regular( Age between12 -55) =$ 18.25
Seniors (55 and above) = $15.00
Tax =7%
Your program should ask the user to enter the total number of members in their group.
User needs to enter the ages for all members. Write appropriate error messages for invalid entries.
An array should be used to store the ages of the family members.
Based on the age it has to calculate the cost of each member and calculate the total cost including tax.
Your program should display
The number of tickets for each type
And the total cost for the group
After display your program should repeat the process until the user wants to stop.
Your program must use
Sample run of the program:
Welcome to our WATERPARK!!!
Please enter the number of members in your group. 7
Please enter the ages for each person in your group. 15 28 11 34 26 60 58
Please pay the total of $115.50 + 7% tax = $ 123.59
And pick up
1 Kid ticket
4 Regular tickets and
2 Senior tickets
Please Press a positive number for next customer, Negative number to end. 5
Welcome to our WATERPARK!!!
Please enter the number of members in your group.
In: Computer Science
Program 3: Give a baby $5,000! Did you know that, over the last century, the stock market has returned an average of 10%? You may not care, but you’d better pay attention to this one. If you were to give a newborn baby $5000, put that money in the stock market and NOT add any additional money per year, that money would grow to over $2.9 million by the time that baby is ready for retirement (67 years)! Don’t believe us? Check out the compound interest calculator from MoneyChimp and plug in the numbers!
To keep things simple, we’ll calculate interest in a simple way. You take the original amount (called the principle) and add back in a percentage rate of growth (called the interest rate) at the end of the year. For example, if we had $1,000 as our principle and had a 10% rate of growth, the next year we would have $1,100. The year after that, we would have $1,210 (or $1,100 plus 10% of $1,100). However, we usually add in additional money each year which, for simplicity, is included before calculating the interest.
Your task is to design (pseudocode) and implement (source) for a program that 1) reads in the principle, additional annual money, years to grow, and interest rate from the user, and 2) print out how much money they have each year. Task 3: think about when you earn the most money! Lesson learned: whether it’s your code or your money, save early and save often…
Sample run 1:
Enter the principle: 2000
Enter the annual addition: 300
Enter the number of years to grow: 10
Enter the interest rate as a percentage: 10
Year 0: $2000
Year 1: $2530
Year 2: $3113
Year 3: $3754.3
Year 4: $4459.73
Year 5: $5235.7
Year 6: $6089.27
Year 7: $7028.2
Year 8: $8061.02
Year 9: $9197.12
Year 10: $10446.8
Sample run 2 (yeah, that’s $9.4MM):
Enter the principle: 5000
Enter the annual addition: 1000
Enter the number of years to grow: 67
Enter the interest rate as a percentage: 10
Year 0: $5000
Year 1: $6600
Year 2: $8360
Year 3: $10296
Year 4: $12425.6
Year 5: $14768.2
.
.
Year 59: $4.41782e+06
Year 60: $4.86071e+06
Year 61: $5.34788e+06
Year 62: $5.88376e+06
Year 63: $6.47324e+06
Year 64: $7.12167e+06
Year 65: $7.83493e+06
Year 66: $8.61952e+06
Year 67: $9.48258e+06
////////////( PLEASE WRITE IN PSEUDOCODE )/////////////////
In: Computer Science
C++ Parse text (with delimiter) read from file.
If a Text file has input formatted such as: "name,23" on every line where a comma is the delimiter, how would I separate the string "name" and integer "23" and set them to separate variables for every input of the text file? I am trying to set a name and age to an object and insert it into a vector.
#include <iostream>
#include <vector>
#include <fstream>
using namespace std;
class Student{
public:
string name;
int age;
};
int main() {
vector <Student>studentVector;
Student s;
string student_name;
int student_age;
ifstream myFile("file.txt");
while(myFile>> student_name >>
student_age){
//s.name is assigning
the entire line of unparsed text
s.name =
student_name;
///age is not read because input string from file is not parsed
s.age = student_age;
studentVector.push_back(s);
}
return 0;
}
In: Computer Science
In: Computer Science
Code: please use in visual studio 2019 c++ (not java)
In total you will write 6 functions:
Functions :
A ) addInts, returns int; input is two ints; Add the values of the two parameters and return the sum
B) subInts , returns int; input is two ints; Subtract the values of the two parameters and return the difference
C) multInts, returns int; input is two ints; multiple the values of the two parameters and return the product
D) divInts, returns int; input is two ints; Divide the values of the two parameters and return the quotient
E) modInts, returns int; input is two ints; compute the residual of the values of the two parameters and return the residual
F) A function called computeOperation ( ) that , returns an int; input is three parameters: one 'control' int, and two ints;
if the control int ( the first parameter) is :
Control
Control Parameter | compute return value : |
1 | Return sum of 2nd and 3td parameters |
2 | Return diff of 2nd and 3td parameters |
3 | Return product of 2nd and 3td parameters |
4 | Return quotient of 2nd and 3td parameters |
5 | Return modulus of 2nd and 3td parameters |
expect to see both Function Declarations and of course the Function Definitions for all 6 functions
expect to see some obvious test code or data sets.
expect to see a switch statement not a series of if statements if it is appropriate.
To Be Clear:
in the main function there should be a homework header and then a bunch of 'call's to the
computeOperation ( ) function.
And
computeOperation should then have code to invoke one of the 5 low level compute functions. The value that is returned should be returned by computeOperator.
In: Computer Science
Find the statistics for a single quantitative variable by utilizing Encapsulation and Namespace functions:
Each function should accept a list as an input parameter:
List = [1,2,3,4,5,6]
Functions : lst_min, lst_max, lst_range, lst_variance, lst_stdev.
Use: Python programming language, please. (Note: without inbuilt function)
Thank you.
In: Computer Science
Are Gradient boosting model, Random Forest, XGBoost, and LightGBM all tree-based models??
Thanks!
In: Computer Science