1.A method called sine,which takes asits only parameter avalue oftype double,and returns a valueof type doubleThe parameter represents anangle expressed inradians,andthe value returned bythe method representsthe trigonometric sine ofthis angleFor example,suppose thefollowingmethod
call isexecuted:double sin=MathAssignment.sine(1.047197551)
After the execution ofthe above method call,thevalue stored invariable sin willbe(approximately)0.866025404,as the sine of 1.047197551radians is approximately 0.866025404Thesine ofan angle x,denoted sinx,canbe calculated usingthe following algorithm:If x<-π,repeatedly add2π toxuntil-π≤x≤π.Conversely,ifx>π,repeatedlysubtract2π
fromxuntil-π≤x≤πYou MUST use 3.141592653589793 as a value for π
Calculate sinx using the following formula:where t0=xTo calculate the other terms in the sum,we usethe following formula:where ti isan arbitrary term,and ti+1 isthe next termFor example:and so onThelast term in this sum,tn,will bethe firstterm whose absolute valueis lessthan10-10
# You work at a low latency trading firm and are asked to deliver the order book data provided in order_book_data.txt to a superior
# The problem is that the data isn't formatted correctly. Please complete the following steps to apropriately format the data
1. Open order_book_data.tx
3. Get rid empty lines
4. Get rid of spaces
5. Notice that there are two currencies in the order book; USD and YEN. Please convert both the Bid and Ask price to USD
6. Create a header line ['Symbol,Date,Bid,Ask']
7. Save the header line and properly formatted lines to a comma seperated value file called mktDataFormat.csv
Writing a small program for Bank Management System.
In this program, we are using the concept of C++ class and object, following basic
operations are being performed:
• Deposit
• Withdraw
In this program, we have created a class Bank with the following member functions:
• Deposit() – It will ask for the amount to be added in available balance, and deposit
the amount.
• Withdrawal() – It will ask for the amount to be withdrawn from the available, will
also check the available balance, if balance is available, it will deduct the amount
from the available balance.
Create a class called Match that will have team objects and be used for creating a Match of play.
Data Members:
-This class has two data members named HomeTeam and VisitorTeam which are of type Team, they will store that two teams that will play the Match.
Methods:
-This class doesn’t have a default constructor, it only has one constructor which receives two Team object that will be assigned to HomeTeam and VisitorTeam. setTeams(),which receives two Team object that will be assigned to HomeTeam and VisitorTeam.
-playMatch(), simulates match play by calling the scoreGoals methods of each team.
-getPlayGound(), returns the ground of play which is the HomeGound of the HomeTeam. -isDrawMatch(), will return true if the Match is a draw and false if there is a winner.
-The match is a draw if the goals of the teams are equal. getWinner(), returns the team which won the match, a team wins if its goals is higher than the goals of the other team.
-getLoser(), returns the team which lost the match.
2. Three is a Crowd
by CodeChum Admin
This one’s pretty simple as well, but I hope you haven’t forgotten how to create a new line!
Instructions:
Input three random characters and make sure they are inputted on different lines.
Print out the three strings in order, each on a different line, using only 1 std::cout statement and newline characters (\n). An initial code with 1 std::cout is already provide for you. Don't add more std::cout's!
Input
Three lines containing a character on each.
A
B
C
Output
Three lines containing a character on each.
A
B
C
3. Input + Addition
by CodeChum Admin
Hopefully you haven't forgotten about your previous lesson, because you're going to need it for this one.
Instructions:
Input two integers (one per line) and make sure to store them in variables.
Add the two integers and print out their sum!
Input
Two lines containing an integer on each.
6
6
Output
A line containing the addition of the two inputted integers.
12
Code
4. Decimal x Decimal
by CodeChum Admin
Now that we're done with integers, we're moving on to decimals!
Instructions:
Input three decimal numbers in one line separated by spaces, and make sure to store them in different variables.
Multiply the 1st and 2nd decimal numbers, and store the product into a variable.
Then, divide the product of the 1st and 2nd decimal numbers with the 3rd decimal number, then print out its quotient, with 2 decimal places.
Input
A line containing three decimal numbers with two decimal places separated by a space.
*Test Case 1
1.53·2.25·1.23
Output
A line containing the result with two decimal places.
2.80
*Test Case 2
Input
1.9 2.5 3.75
Expected Output
1.27
create a Java application which will Simulate a Soccer game Match and display the results.
Question 1 – Team.
Create a class called Team that will be used for creating team objects, the class must have the following data members and methods:
Data Members:
-Name,the name of the team.
-HomeGround, the name of the Home stadium of the team.
-Goals, the number of goals that the team scores during the match Choose appropriate types for the data members.
Methods:
-A default constructor which will initialize all data members to proper initial values.
-An overloaded constructor which receives two arguments; a team name and home ground name and it should also initialize the goals to a proper initial value.
scoreGoals(), since a team can score 0 to 4 goals, this helper method must assign the Goals data member to a random number in that range.
-getName(), getHomeGround(), getGoals(), create get methods for each data member
The Math class, which is part of the Java standard class library, provides various class methods that perform
common calculations, such as trigonometric functions.
Write a class called MathAssignment, which provides some of the functionality which is also provided by
the Math class. This class should define the static methods described below:
A method called absoluteValue, which takes as its only parameter a value of type double, and
returns a value of type double. The parameter represents an arbitrary number, and the value returned
by the method represents the absolute value of this arbitrary number. The absolute value of a number
x, denoted |x|, is x if x is greater than or equal to 0, and -x if x is less than 0. For example, suppose the
following method call is executed:
double value = MathAssignment.absoluteValue(-42.0);
After the execution of the above method call, the value stored in variable value will be 42.0, as the
absolute value of -42 is 42.
Write a program using pseudocode to create four functions add(a,b) to add a and b then return the result, similarly sub(a,b), mult(a,b), div(a,b) to perform mathematical operations. Provide a menu to choose which calculation to perform. Parameters a and b are inputs from user.