Saturday 14:00 Homework
Home > Saturday 14:00 Homework (Page 8)
Question:
Create the following * pattern image base on your input
Sample Input 1:
3
Sample Output 1:
*
**
***
***
**
*
Sample Input 2:
5
Sample Output 2:
*
**
***
****
*****
*****
****
***
**
*
...
Question:
Create the following * pattern image base on your input
Sample Input 1:
3
Sample Output 1:
***
**
*
*
**
***
Sample Input 2:
5
Sample Output 2:
*****
****
***
**
*
*
**
***
****
*****
Sample Input 3:
1
Sample Output 3:
*
*
Sample Input 4:
2
Sample Output 4:
**
*
*
**...
Question:
You have two strings. Find the number of characters you have to add to make them anagrams of each other.
Sample Input 1:
abc
abd
Sample Output 1:
2
Sample Input 2:
abcd
abc
Sample Output 2:
1
Sample Input 3:
abcd
a
Sample Output 3:
3...
Question:
Write a method that returns the product of all numbers in an array....
Problem Description
We often include emoticons in our text messages to indicate how we are feeling.
The three consecutive characters :-) indicate a happy face and the three consecutive characters :-( indicate a sad face.
Write a program to determine the overall mood of a message.
Input...
Problem Description
Suppose we have a number like 12. Let’s define shifting a number to mean adding a zero at the end. For example, if we shift that number once, we get the number 120. If we shift the number again we get the number 1200....
Question:
Write a method to check the validity of password input by users.
Validation :
At least 1 letter between [a-z] and 1 letter between[A-Z].
At least 1 number between [0-9].
At least 1 character from [$#@].
Minimum length 6 characters.
Maximum length 16 characters.
...
Question 1:
Write a method to find the base to the exponent of a number
for example: 2^5=32 , 3^4=81
In the input first number is the base and the second number is the exponent
Sample Input 1:
2
5
Sample Output 1:
32
Sample Input 2:
3
4
Sample Output 2:
81
Sample Input 3:
9
2
Sample Output 4:
81...
Question:
Write a method luckySum(int a, int b, int c) to calculate sum of given 3 int values, a b c. The function will have a return value of their sum. However, if one of the values is 13 then it does not count towards the...
Question:
Using function or object method to write a program to return the number of times that the string “code” appears anywhere in the given string, except we’ll accept any letter for the ‘d’, so “cope” and “cooe” count.
For example:
‘aaacodebbb’ will have 1 “code”
‘codexxcode’ will have 2 “code”
‘cozexxcope’...