Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

Lv 1100 points

Jay-R R

Favorite Answers19%
Answers42
  • How to root Visual Land Prestige Pro 7D?

    I'm trying to root this tablet but I can't seem to do it. I've downloaded Unlock Root Pro but it saying it needs the device drivers for the tablet which I don't and I've checked the manufacturers website and they don't have it either. Does anyone know how to Root this tablet?

    3 AnswersOther - Computers8 years ago
  • C Programming parking charge function?

    A parking garage charges a $7 minimum to park for up to three hours. The garage charges an additional $2 per hour for each hour or part thereof in excess of three hours. The maximum charge for any 24-hour period is $33. Write a function int parking_charge(float hours) that calculates the parking charge given a number of hours as a floating point value. Assume that no car is parked for more than 24 hours.

    I wrote the function and I was wondering if someone can check if it's right. I intentionally left out the printf statements cause I was lazy.

    int parking_charge ( float hours )

    {

    int min_charge = 7;

    int total_charge;

    if ( hours <= 3 )

    {

    total_charge = min_charge;

    }

    if ( ( hours > 3 ) && ( hours < 24 ) )

    {

    total_charge = ( hours / 60 ) * 2 * min_charge ;

    }

    if ( hours == 24 )

    {

    total_charge = 33;

    }

    }

    2 AnswersProgramming & Design9 years ago
  • C Programming Review questions check?

    Hey guys I'm answering some questions to get ready for my final and I need someone to double check the answers. There's like maybe 2 sub questions that I didn't know the answer to, so if you guys could help me out with those that would be awesome.

    1. What does the following statement do?

    #include <stdio.h>

    makes the functions within the standard input/output library available for use in the program

    2. What integer types does C have? Why does C have more than one integer type?

    int, float, double //I'm not sure about this one

    3. Calculate the value of i after each of the following independent statements. Assume that i contains 2 and j contains 1 before each statement is executed.

    (a) i += j;

    (b) i- -;

    (c) i = i * j / i;

    (d) i = i % ++j;

    A) i = 3

    B) i = 3 //i know this one is decremented

    C) i = 1

    D) i = 1

    4. Construct a C statement to divide two variables of type int, d1 and d2, as floating-point values, and assign the result to the variable d of type double.

    int d1, d2;

    double d = (float) d1 / d2;

    5. Declare an array of five ints and initialize it to the first five odd positive integers.

    int array[5] = {1, 3, 5, 7, 9};

    6. Use enum to define an enumeration type called Response with the possible values Yes, No, and Maybe. Yes should be 1, No should be 0, and Maybe should be 2.

    enum Response = {Yes = 1. No = 0, Maybe = 2};

    7. Construct logical expressions to represent the following conditions:

    (a) number weight is greater than or equal to 115 but less than 125

    (b) character ch is q or Q

    (c) number n is even but is not a multiple of 26

    (d) ch is a lowercase letter or an uppercase letter (assume that lowercase letters are coded sequentially and that uppercase

    letters are coded sequentially but that there is a gap in the code between uppercase and lowercase.)

    A) (( weight >= 115 ) && weight < 125);

    B) char ch = 'q' || 'Q';

    C) (( n % 2 == 0 ) && 26 % n != 0 );

    D) HELP ON THIS PLEASE

    8. Suppose that the following declarations are in effect:

    int a [ ] = { 5 , 15 , 34 , 54 , 14 , 2 , 52 , 72 } ;

    int * p = &a [ 1 ] ;

    int * q = &a [ 5 ] ;

    (a) What is the value of *(p + 3)?

    (b) What is the value of *(q - 2)?

    (c) What is the value of q - p?

    (d) Is p < q true or false?

    (e) Is *p < *q true or false?

    A) 14

    B) 54

    C) 30

    D) true

    E) true

    9. What would the following code print if it were part of a valid program, and why?

    int k = 8 ;

    do

    printf( ” k␣=␣%d \ n” , k ) ;

    while ( k ++ < 5 ) ;

    It will print out the value of k once and stop b/c the test expression will always be false

    2 AnswersProgramming & Design9 years ago
  • C programming base^exponent recursive?

    I'm suppose to rewrite this function using recursion but I have no idea how exactly am I suppose to do it.

    #include <stdio.h>

    int power(int base, int exponent);

    int main ()

    {

    int base = 4;

    int exponent = 5;

    power(base, exponent);

    system("pause");

    }

    int power (int base, int exponent)

    {

    int i, result = 1;

    for ( i = 0; i<exponent; i++)

    {

    result *= base ;

    }

    printf("%d", result);

    }

    1 AnswerProgramming & Design9 years ago
  • C programming base^exponent?

    I'm trying to write a program that will show the value of the base 4 multiplied by the exponent 5 to get 1024 but I get 4096. I know there is a function that I can use but I have to write my own code.

    Could anyone tell me what's wrong with the code?

    #include <stdio.h>

    void time(int hours, int minutes);

    int main ()

    {

    int base = 4;

    int exponent = 5;

    int i, result = 1;

    for ( i = 0; i<=exponent; i++)

    {

    result *= base ;

    }

    printf("%d", result);

    system("pause");

    }

    2 AnswersProgramming & Design9 years ago
  • C programming read file and display only the numbers?

    I'm trying to write part of a code where it reads a file that has the contents " 120 gas." "345 phone" "90 electricity" in it and I want to separate the numbers and the names of the bills and put them into an array located in a structure. (FYI the number means how much the bill is). I wrote a small program to just try and separate 120 gas and just print out only 120 but everytime i ran the program it kept running infinitely printing 1.

    here's my code:

    #include <stdio.h>

    #include <stdlib.h>

    #include <string.h>

    typedef struct {

    int cpu_price[];

    char cpu_name[];

    } price_entry;

    int main ()

    {

    FILE *file_ptr;

    char ch;

    file_ptr = fopen("test.txt", "r");

    char array[5];

    int i;

    while ( 1 )

    {

    ch = fgetc(file_ptr);

    if( ch == EOF )

    break;

    for (i = 0 ; 0 < 5 ; i++){

    if ( ch == 1||2||3||4||5||6||7||8||9 )

    printf("%c", ch);}

    system("pause");

    }}

    what i'm also trying to do is sort the three prices in decresing order with it the names of the bills but i'll settle for fixing this program.

    2 AnswersProgramming & Design9 years ago
  • C programming sorting program help?

    Hey guys,

    I got an assigment that I need help with and I'm hoping that someone could give me some help with it. Here is what it's asking:

    The data file contains lines of text, some of which are tab-delimited price entries, while others are text.

    Each price line is easily distinguished by the fact that it begins with a digit. Each price line has an Intel CPU’s

    current price, followed by a tab character, followed by the CPU’s name.

    Begin by defining a struct type that can store a CPU name and its price. Write a C program that includes

    three separate functions:

    1. read_price_list() reads the price list from the data file and stores it in an array of your structs,

    2. sort_price_list() sorts the price list by decreasing price,

    3. write_price_list() writes the sorted price list into a new data file Sorted_Price_List.txt.

    The sorted price list file must contain only sorted price data: a CPU price, followed by a tab, followed by the

    CPU’s name; one CPU per line.

    Here is what we have to sort:

    Intel® Processor Pricing

    Effective Apr 29, 2012

    Recommended Customer Price Tray Units

    Intel® Core™ i7 processor Extreme Edition Desktop (LGA2011)

    999 i7-3960X (15M cache, 6 Cores, 12 Threads, 3.30 GHz, 32nm)

    Intel® Core™ i7 processor Desktop (LGA2011/1155)

    583 i7-3930K (12M cache, 6 Cores, 12 Threads, 3.20 GHz, 32nm)

    294 i7-3820 (10M cache, 4 Cores, 8 Threads, 3.60 GHz. 32nm)

    332 i7-3770K (8M cache, 4 Cores, 8 Threads, 3.50 GHz. 22nm)

    294 i7-3770 (8M cache, 4 Cores, 8 Threads, 3.40 GHz. 22nm)

    332 i7-2700K (8M cache, 4 Cores, 8 Threads, 3.50 GHz, 32nm)

    317 i7-2600K (8M cache, 4 Cores, 8 Threads, 3.40 GHz, 32nm)

    294 i7-2600 (8M cache, 4 Cores, 8 Threads, 3.40 GHz, 32nm)

    Intel® Core™ i5 processor Desktop (LGA1155)

    225 i5-3570K (6M cache, 4 Cores, 4 Threads, 3.40 GHz, 22nm)

    205 i5-3550 (6M cache, 4 Cores, 4 Threads, 3.30 GHz, 22nm)

    184 i5-3450 (6M cache, 4 Cores, 4 Threads, 3.10 GHz, 22nm)

    225 i5-2550K (6M cache, 4 Cores, 4 Threads, 3.40 GHz, 32nm)

    216 i5-2500K (6M cache, 4 Cores, 4 Threads, 3.30 GHz, 32nm)

    205 i5-2500 (6M cache, 4 Cores, 4 Threads, 3.30 GHz, 32nm)

    195 i5-2450P (6M cache, 4 Cores, 4 Threads, 3.20 GHz, 32nm)

    184 i5-2400 (6M cache, 4 Cores, 4 Threads, 3.10 GHz, 32nm)

    177 i5-2380P (6M cache, 4 Cores, 4 Threads, 3.10 GHz, 32nm)

    177 i5-2320 (6M cache, 4 Cores, 4 Threads, 3.00 GHz, 32nm)

    177 i5-2310 (6M cache, 4 Cores, 4 Threads, 2.90 GHz, 32nm)

    There's more to sort but it takes up alot of space.

    And he gave us a skeleton source file:

    #include <stdio.h>

    #include <stdlib.h>

    #include <string.h>

    typedef struct {

    /* fill in */

    } price_entry;

    /* Reads a price list from a file and stores it in an array of structs.

    Returns the number of price entries read from the file. */

    int read_price_list(const char* input_name, price_entry* list, int list_size) {

    /* only lines beginning with a digit contain price entries, ignore all other lines */

    /* fill in */

    }

    int compare_price_entries(const price_entry* entry1, const price_entry* entry2) {

    /* fill in */

    }

    /* Sorts a price list by decreasing price. */

    void sort_price_list(price_entry* list, int list_size) {

    /* use qsort() in conjunction with the compare_price_entries above, or write your own sort algorithm */

    /* fill in */

    }

    /* Writes a price list into a new file. */

    void write_price_list(const price_entry* list, int list_size, const char* output_name) {

    /* fill in */

    }

    int main() {

    int entry_count;

    entry_count = read_price_list("Apr_29_12_Recommended_Customer_Price_List.txt", /* fill in */);

    sort_price_list(/* fill in */);

    write_price_list(/* fill in */, "Sorted_Price_List.txt");

    return 0;

    }

    I've been working on in since Wed and I am completely stuck and any kind of help would be appreciated.

    1 AnswerProgramming & Design9 years ago
  • Java Guessing Game problem.?

    I wrote a program where it stores random numbers in an array. It all works fine except for when I want it to display the ratio it always gives me 0.0%. Can somebody help me out? Thanks.

    import java.util.Scanner;

    public class GuessNumberInArray {

    public static void main(String[] args) {

    int returnValue, guess;

    int right = 0, totalAnswered = 0;

    double ratio = (right / (totalAnswered - 1)) * 100;

    Scanner input = new Scanner(System.in);

    //creates an array containing 50 elements

    int [] storedNumbers = new int [50];

    //stores a random number

    for ( int i = 0 ; i < storedNumbers.length ; i++)

    storedNumbers[i] = (int)(1 + Math.random() * 100);

    System.out.println("Guess a number in the array with the range of 1-100 [Enter a negative integer "

    + "to quit]");

    do{

    //User guesses a number in the array

    guess = input.nextInt();

    //When the user guesses a number the variable returnValue calls the linearSearch method to check

    //if the number guessed is in the array

    returnValue = linearSearch( storedNumbers, guess);

    if ( returnValue >= 0 )

    {

    System.out.println("Correct");

    right += 1;

    totalAnswered += 1;

    }

    else

    {

    System.out.println("Wrong");

    totalAnswered += 1;

    }

    }

    while ( guess >= 0 );

    //When the user enters a negative number to end the loop that negative number is still added to the

    //totalAnswered variable, so I subtract 1 to remove it.

    System.out.println("\n\n"+right + "/" + (totalAnswered -1));

    System.out.println("Your ratio is " + ratio +"%");

    }

    public static int linearSearch( int[] storedNumbers, int guess){

    for ( int i = 0 ; i < storedNumbers.length ; i++)

    {

    if ( guess == storedNumbers[i])

    return i;

    }

    return -1;

    }

    }

    4 AnswersProgramming & Design9 years ago
  • C programming: Dice game?

    Hi guys,

    I'm writing a dice program where it runs 3.6 million times and and gives two random numbers and then adds those two. I also have to keep track of how many times the sum of the two added numbers shows up. For example if the sum is 7 and it shows up 100,000 times then the program will show that the sum 7 shows up 100,000 times. I wrote the code, which I know could be written a lot shorter but I'm fighting off a cold right now so I'm really lazy, and every time I run it it only tells me that the sum 2 shows up 3600001.

    int main (){

    int i = 3600000 ;

    int ranNum1;

    int ranNum2;

    int sum = ranNum1 + ranNum2 ;

    int two = 0, three = 0, four = 0, five = 0, six = 0, seven = 0, eight = 0, nine = 0, ten = 0, eleven = 0, twelve = 0;

    while ( i >= 0)

    {

    ranNum1 = rand() % 6 +1;

    ranNum2 = rand() % 6 +1 ;

    sum = ranNum1 + ranNum2 ;

    i--;

    if ( sum == 2)

    {

    two += 1;

    }

    if ( sum == 3)

    {

    two += 1;

    }

    if ( sum == 4)

    {

    two += 1;

    }

    if ( sum == 5)

    {

    two += 1;

    }

    if ( sum == 6)

    {

    two += 1;

    }

    if ( sum == 7)

    {

    two += 1;

    }

    if ( sum == 8)

    {

    two += 1;

    }

    if ( sum == 9)

    {

    two += 1;

    }

    if ( sum == 10)

    {

    two += 1;

    }

    if ( sum == 11)

    {

    two += 1;

    }

    if ( sum == 12)

    {

    two += 1;

    }

    }

    printf("The sum of two random numbers, which is 2 shows up: %d\n", two);

    printf("The sum of two random numbers, which is 3 shows up: %d\n", three);

    printf("The sum of two random numbers, which is 4 shows up: %d\n", four);

    printf("The sum of two random numbers, which is 5 shows up: %d\n", five);

    printf("The sum of two random numbers, which is 6 shows up: %d\n", six);

    printf("The sum of two random numbers, which is 7 shows up: %d\n", seven);

    printf("The sum of two random numbers, which is 8 shows up: %d\n", eight);

    printf("The sum of two random numbers, which is 9 shows up: %d\n", nine);

    printf("The sum of two random numbers, which is 10 shows up: %d\n", ten);

    printf("The sum of two random numbers, which is 11 shows up: %d\n", eleven);

    printf("The sum of two random numbers, which is 12 shows up: %d\n", twelve);

    system("pause");

    }

    2 AnswersProgramming & Design9 years ago
  • generating random numbers from array in c?

    Hi guys,

    I'm trying to print a random number from an array but it's not working the way I want.

    Here is the problem question:

    For each set of integers below, write a single statement that will print a number at random from the set. (Hint: Use the function rand().)

    Here's my code:

    int arrayA[4] = { 2, 4, 6, 8};

    int random = rand(arrayA);

    printf("%d", random);

    When I run the program it always gives me 41.

    2 AnswersProgramming & Design9 years ago
  • java programming: adding random numbers?

    I've written a program that will generate n numbers but now I'm stuck on how to add them up together and then find the average.

    import java.util.Scanner;

    public class FindAverage {

    public static void main(String[] args) {

    Scanner input = new Scanner(System.in);

    System.out.print("Enter n: ");

    int number = input.nextInt();

    for ( int i=0; i<number;i++){

    int secretNumber=(int)(1000 * Math.random ()) + 1 ;

    System.out.print(secretNumber + " ");

    }

    }

    }

    3 AnswersProgramming & Design9 years ago
  • How can I generate a certain amount of random numbers in java.?

    I'm trying to write a program where the user enters a number and the program will generate that many random numbers. For example the user enters 5 and the program shows 1,9,5,7,6.

    I have so far:

    Scanner input = new Scanner(System.in);

    System.out.print("Enter n: ");

    int n = input.nextInt();

    *****This is where I'm stuck because I'm not sure how to use whatever number the user enters and have the program generate that many random numbers. If you could help me out that would be great and if you could explain I would appreciate it.

    There's another part to this program but I'm pretty sure I know how to write it.

    2 AnswersProgramming & Design9 years ago
  • guessing game java programming?

    I'm having trouble writing a java program where:

    Guessing Game: Computer generates a number in a range between 1 and 100. And then ask user enter a guess. When user’s guess is lower than the answer, then give a hint (Too low) and then show a new range for next guess as shown in the sample run. If player enters a value outside of valid range, then you should give a warning and request a valid input. Player can guess until they get the right answer and program tracks the number of guess.

    Hint: Use the Math.random() method to calculate a random value.

    Here is a sample run:

    Okay, I decided a number between 1 and 100. Try a guess[1,100]: 45

    Noop! Try lower. [1,44]: 20

    Noop! Try lower. [1,19]: 10

    Noop! Try higher. [11,19]: 15

    YES!! You got it after 4 times.

    I can write the simpler code of what it's asking but I'm having trouble when it asks "When user’s guess is lower than the answer, then give a hint (Too low) and then show a new range for next guess as shown in the sample run."

    Here's the code I have:

    int secretNumber=(int)(101 * Math.random ()) + 1 ;

    int guess;

    int numberOfGuesses;

    Scanner input = new Scanner(System.in);

    numberOfGuesses = 0;

    System.out.println("Guess a number between 1 and 100:");

    do {

    guess = input.nextInt();

    numberOfGuesses++;

    if(guess > secretNumber){

    System.out.println("Too high.");}

    else if(guess < secretNumber){

    System.out.println("Too low.");}

    else{

    System.out.println("Good job.");

    System.out.println("Number of Guesses: "+ numberOfGuesses);}}

    while(guess != secretNumber);

    }}

    6 AnswersProgramming & Design9 years ago
  • C Programming. Foreign currency to dollars?

    I'm trying to write a program where I convert foreign currency to US dollars, but I'm having trouble starting it. I'm not asking for someone to write the whole code just the part that I'm currently stuck on, which is having the user type in a letter: Y for yen, E for euro, L or P for pounds and then the number. Also the user can type in either upper or lower case. I've tried writing the code where the user just enters a lower case or upper case "Y" and any other letter would print out to the console "Wrong input". The code that I've written asks the user to enter the letter but when I type any letter it doesn't display anything. Please help and thanks.

    char jyp1 = 'Y';

    char jyp2 = 'y';

    printf("Enter Y, E, L or P");

    if ( jyp1 || jyp2){

    scanf("%c", jyp1, &jyp2);

    printf("%c", jyp1, jyp2);}

    else {

    printf("Wrong input");}

    This is an example of what the output should look like:

    Enter currency (Y/E/L/P) and amount: Y1000

    Equivalent dollar amount is $11.87

    1 AnswerProgramming & Design9 years ago
  • Use the midpoint Rule to estimate the area under the graph of f(x)=3/x and above the graph of f(x)=0 from x0=1?

    Use the midpoint Rule to estimate the area under the graph of f(x)=3/x and above the graph of f(x)=0 from x0=1 to xn=25 using two rectangles of equal width and four rectangles of equal width.

    I need help with this. if you could give a step-by-step that would be great. thanks

    3 AnswersHomework Help1 decade ago
  • Why did political parties emerge in the 1790s?

    What were the parties and what did they stand for?

    1 AnswerHistory1 decade ago
  • Why did Tenskwatawa and Tecumseh lead their people against the Americans?

    Who were they, what were they trying to accomplish, and to what extent did they succeed?

    3 AnswersHistory1 decade ago