Assume that name is a variable of type String that has been assigned a value. Write an expression whose value is a String containing the last character of the value of name. So if the value of name were “Smith” the expression’s value would be “h”.

java

LANGUAGE:  JAVA CHALLENGE: Assume that name is a variable of type String that has been assigned a value. Write an expression whose value is a String containing the last character of the value of name. So if the value of name were “Smith” the expression’s value would be “h”.

Read More

Assume that name has been declared suitably for storing names (like “Amy”, “Fritz” and “Moustafa”)

java

LANGUAGE:  JAVA CHALLENGE: Assume that name has been declared suitably for storing names (like “Amy”, “Fritz” and “Moustafa”). Assume also that stdin is a variable that references a Scanner object associated with standard input. Write some code that reads a value into name then prints the message “Greetings, NAMEVALUE!!!” on a line by itself where…

Read More

Given an integer variable i and a floating-point variable f, that have already been given values, write a statement that writes both of their values to standard output in the following format

java

LANGUAGE:  JAVA CHALLENGE: The exercise instructions here are LONG — please read them all carefully. If you see an internal scrollbar to the right of these instructions, be sure to scroll down to read everything. Given an integer variable i and a floating-point variable f, that have already been given values, write a statement that…

Read More

Write a program that takes the account’s present value, monthly interest rate, and the number of months that the money will be left in the account as three inputs from the user.

Python

LANGUAGE:  PYTHON CHALLENGE: Suppose you have a certain amount of money in a savings account that earns compound monthly interest, and you want to calculate the amount that you will have after a specific number of months. The formula is as follows: f = p * (1 + i)^t • f is the future value…

Read More

Write a Boolean function named is_prime which takes an integer as an argument and returns true if the argument is a prime number, or false otherwise. Use the function in a program that prompts the user to enter a number and then prints whether the number is prime.

Python

LANGUAGE:  PYTHON CHALLENGE: A prime number is a number that is only evenly divisble by itself and 1. For example, the number 5 is prime because it can only be evenlly divided by 1 and 5. The number 6, however, is not prime because it can be divided evenly by 2 and 3. Write a…

Read More

Write an expression (not a statement!) whose value is the largest of population1, population2, population3, and population4 by calling max2.

Python

LANGUAGE:  PYTHON CHALLENGE: assume that max2 is a function that expects two int parameters and returns the value of the larger one. Also assume that four variables , population1, population2, population3, and population4 have already been defined and associated with int values. Write an expression (not a statement!) whose value is the largest of population1,…

Read More

Write an expression (not a statement!) whose value is the larger of population1 and population2 by calling max.

Python

LANGUAGE:  PYTHON CHALLENGE: max is a function that expects two int parameters and returns the value of the larger one. Two variables , population1 and population2, have already been defined and associated with int values. Write an expression (not a statement!) whose value is the larger of population1 and population2 by calling max.

Read More