A chemist runs a thin-layer chromatography plate and marks the solvent as having traveled 6.1 cm up the plate. After visualization, the distance of the spot of interest is measured as having traveled 2.7 cm. Select the correct Rf value of this spot
In: Chemistry
In: Computer Science
Latitude and Longitude are the two components used to exactly identify a specific spot on the Earth. Latitude provides the North/South direction and runs from 90 degrees north at the north poll to -90 degrees south at the south poll. The equator has a Latitude of zero.
Longitude provides the East/West direction and runs from the Prime Meridian that runs through Greenwich, England and has a Longitude of zero. Longitudes then run negatively to the west and positively to the east with the maximum Longitude being 180 degrees (or -180 degrees. They are the same Longitude.)
Usually Latitude and Longitude are usually depicted in degrees, minutes and second, but they can also be represented with just real numbers, which is how your class will need to be written. (FYI Lake Worth has a 26.61353 latitude and -80.057458)
Your assignment is to create a class called locCoordinates with the following properties and methods:
class locCoordinates
{
private:
double latitude;
double longitude;
string location;
public:
locCoordinates();
bool set(double, double, string)
bool setLatitude(double);
bool setLongitude(double);
void setLocation(string);
double getLatitude();
double getLongitude();
string getLocation();
void moveUpDown (double, string);
void moveLeftRight (double, string);
void move (double, double, string);
void print();
}
And here are the specifics for this class.
The constructor should set the latitude and longitude to zero, and the location to "Prime Meridian at Equator). It should not accept any parameters (and should not call the set function).
The set function will take the two numbers entered (latitude then longitude) and ensure they are correct. If either of the numbers are not within the correct range, then the location should be set to "Error", the value of the invalid entry should be set to zero and the function return a false. If everything is good it returns a true.
setLatitude will change the current value of Latitude. It also needs to check to make sure that it is a good latitude. If not correct the function should set the Latitude to zero and return false otherwise return true. In either case, the Location should be changed to "Unknown".
setLongitude does what setLatitude does, only to the Longitude.
setLocation just updates the location string in the class.
The gets return the values in the properties.
moveUpDown will pass in a double that may be either negative or positive. This value needs to be adjusted for the number of total degrees in the latitude, and then the latitude adjusted by that amount. The location would then also be updated.
moveEastWest does just like moveUpDown, but does it for Longitude.
move takes both a change in Latitude and Longitude and applies them along with setting the new location. (If I were coding this, I would probably just call moveUpDown and moveEastWest to do the work!!)
print will print out:
Latitude: 99.99999, Longitude: 999.99999 is at location: XXXXXX
You can implement this any way you want either by creating separate class header and implementation files, or by just putting everything in one big ole file with a main routine after the class definition. In the main routine, please set up a location with a bad input and show that a false is returned, then set one up with good input. Then use the move command to adjust the coordinates by an amount above 90 (or below -90) for latitude and above 180 (or below -180) for longitude. Then use the print function to print out the results.
I need help it C++
In: Computer Science
C programming
4. Exploring Pointers and Use of Arrays [15 pts]
In a shell environment, programs are often executed using command
lines arguments. For example:
g++ -o cm03_la01 cm03_la01.c.
In C such program can be develop using a standard for which the
main program has two parameters as follows:
int main (int argc, char * argv[ ])
{
/*program here */
}
3
Because of the equivalence between pointers and arrays, the above C
code can also be written as follows:
int main (int argc, char ** argv)
{
/*program here */
}
The first parameter is an integer specifying the number of words
on the command-line, including the
name of the program, so argc is always at least one. The second
parameter is an array of C strings
that stores all of the words from the command-line, including the
name of the program, which is
always in argv[0]. The command-line arguments, if they exist, are
stored in argv[1], ..., up to
argv[argc-1].
Consider the program bin2dec.c, which is a program for binary to
decimal conversion that passes the
binary string as a command line.
For instance by typing ”bin2dec 11111”, you should get the
following message: “The Decimal equivalent is: 31”. Analyze and
understand the functionality
of bin2dec.c. Implement a new program base2dec.c that takes as
command line parameters the
source base 2, 8, or 16 followed by the string of base symbols and
gives the equivalent decimal
value. Below are some examples of execution outputs expected:
“base2dec 3 11111” will have as answer: “Error: The source base
should be 2, , 8, or 16”
“base2dec 2 11111” will have as answer: “The decimal equivalent
value is 31”
“base2dec 16 FF” will have as answer: “The decimal equivalent value
is 255”
“base2dec 8 35” will have as answer: “The decimal equivalent value
is 29”
Deliverable: File base2dec.c
This is what I have so far but it is not complete, please
finish/fix the following code
/*----------------------------------------------------------------------------*/
/* Title: bin2dec.c */
/*----------------------------------------------------------------------------*/
/* Binary to decimal conversion */
/* */
/* To compile: */
/* $ gcc -o bin2dec bin2dec.c */
/* $ chmod 755 bin2dec */
/* */
/* To run: */
/* $ ./bin2dec */
/* */
/*----------------------------------------------------------------------------*/
#include <stdio.h>
#include <math.h>
#include <ctype.h>
#include <string.h>
#include <stdlib.h>
unsigned binary_to_decimal(const char *str)
{
unsigned value, i, p;
/* Check if input is made of 0s(ASCII 48) and 1s (ASCII 49)
*/
for (i= 0; i < strlen(str); i++)
{
if (str[i] != 48 && str[i] != 49 )
{
printf(" Incorrect data\n");
exit (0);
}
}
/* Convert Binary to Decimal
Repeat for each binary digit starting from the last array element
*/
p = strlen(str) -1;
value = 0;
for (i= 0; i < strlen(str); i++)
{
value += (str[p] - 48) * (int)pow((double)2, (double)i);
p--;
}
return value;
}
unsigned hex_to_decimal(const char *str)
{
unsigned value, i, p;
/* Check if input is made of 0s(ASCII 48) and 1s (ASCII 49)
*/
for (i= 0; i < strlen(str); i++)
{
if (str[i] != 48 && str[i] != 49 && str[i] != 50
&& str[i] != 51 && str[i] != 52 && str[i]
!= 53
&& str[i] != 54 && str[i] != 55 && str[i]
!= 56 && str[i] != 57 && str[i] != 65 &&
str[i] != 66
&& str[i] != 67 && str[i] != 68 && str[i]
!= 69 && str[i] != 70)
{
printf(" Incorrect data\n");
exit (0);
}
}
/* Convert Binary to Decimal
Repeat for each binary digit starting from the last array element
*/
p = strlen(str) -1;
value = 0;
for (i= 0; i < strlen(str); i++)
{
value += (str[p] - 48) * (int)pow((double)16, (double)i);
p--;
}
return value;
}
unsigned oct_to_decimal(const char *str)
{
unsigned value, i, p;
/* Check if input is made of 0s(ASCII 48) and 1s (ASCII 49)
*/
for (i= 0; i < strlen(str); i++)
{
In: Computer Science
On a womens basketball team, one player can make 61% of free throws she attempts. A success is making a free throw (in basketball, "making a free throw" means the ball successfully went through the hoop.) The random variable X = the number of free throws made out of the seven attempted. Assume that outcomes of free throw attempts can be considered independent of each other. (a) What is the probability that in a given game, she attempts 7 free throws and makes 3 of them? (4 decimal places) (b) What is the probability that in a given game, she attempts 7 free throws and makes all of them? (4 decimal places) (c) What is the probability that in a given game, she attempts 7 free throws and makes 6 or fewer of them? (4 decimal places) (d) What is the mean (expected value) of number of free throws she makes in 7 attempts? (1 decimal place) (e) Of the choices listed below, which ones indicate that X is a binomial random variable? Select all that apply. X represents the number of failed free throws out of seven attempts. There are seven independent trials. There are two possible outcomes, success (making the free throw) and failure (not making the free throw) The probability of making a free throw is different in each trial. X represents the number of successful free throws out of seven attempts. The probability of making the free throw, 61%, is the same for each trial. If the player fails at the first attempt, she is less likely to successfully make the second and third attempts.
In: Statistics and Probability
In: Finance
"Simon Says" is a memory game where "Simon" outputs a sequence of 10 characters (R, G, B, Y) and the user must repeat the sequence. Create a for loop that compares the two strings starting from index 0. For each match, add one point to userScore. Upon a mismatch, exit the loop using a break statement. Assume simonPattern and userPattern are always the same length. Ex: The following patterns yield a userScore of 4:
simonPattern: RRGBRYYBGY userPattern: RRGBBRYBGY
#include <stdio.h>
#include <string.h>
int main(void) {
char simonPattern[50];
char userPattern[50];
int userScore;
int i;
userScore = 0;
strcpy(simonPattern, "RRGBRYYBGY");
strcpy(userPattern, "RRGBBRYBGY");
/* Your solution goes here */
printf("userScore: %d\n", userScore);
return 0;
}
In: Other
1.(0.5) IF WE ARE GIVEN THE POPULATION STANDARD DEVIATION AND n > 30 DO WE USE THE z-VALUES OR t-VALUES? NOW SHOW WHAT YOU HAVE LEARNED SO FAR WITH DESCRIPTIVE AND INFERENTIAL STATISTICS. YOU ARE PROMOTING ONE I.T. EMPLOYEE AND HAVE TWO CANDIDATES THAT HAVE EACH TAKEN THE SAME 15 SECURITY EXAMS OVER THE PAST YEAR. YOU HAVE TWO FINALIST CANDIDATES WHO HAVE THE FOLLOWING SCORES. SO, WHICH ONE DO YOU PICK AND WHY? (EACH TEST HAD POSSIBLE SCORES RANGING FROM 0 TO 100) A 40 89 90 91 92 89 44 84 85 92 89 90 86 88 92 B 99 85 84 79 81 88 80 85 79 82 81 80 79 83 82
In: Statistics and Probability
In Example 23.3 Chapter 23 of the textbook, we tested whether the average fat lost from 1 year of dieting versus 1 year of exercise was equivalent. The study also measured lean body weight (muscle) lost or gained. The average for the 47 men who exercised was a gain of 0.1 kg, which can be thought of as a loss of –0.1 kg. The standard deviation was 2.2 kg. For the 42 men in the dieting group, there was an average loss of 1.3 kg, with a standard deviation of 2.6 kg. Considering a level of significance of 0.05 (5%), build a test of hypotheses to see whether the average lean body mass lost would be different between dieting and exercising for the population of men similar to the ones in this study.
a) Is this a one-sided or two-sided test?
b) Specify all four steps of your hypothesis test. Use the standard normal curve and Table 8.1 in Chapter 8 of the textbook to find an approximate p-value.
In: Statistics and Probability
8. You are interested in two plant genes: one for plant height and one for flower color. You cross a tall white plant to a short red plant. All of the progeny are tall pink plants
1 4
2 5
3 6
In: Biology