This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
*(Display an integer reversed) Write a method with the following header | |
*to display an integer in reverse order:public static void reverse(int number) | |
*For example, reverse(3456) displays 6543. Write a test program that prompts the | |
*user to enter an integer and displays its reversal. | |
*/ | |
public class SortThreeNumbers_06_04 { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
/** | |
*Write the methods with the following headers | |
*Return the reversal of an integer, i.e., reverse(456) returns 654 | |
*public static int reverse(int number) | |
*Return true if number is a | |
*palindromepublic static boolean isPalindrome(int number) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SumDigitsInteger_06_02 { | |
public static void main(String[] args) { | |
java.util.Scanner input = new java.util.Scanner(System.in); | |
System.out.print("Enter a number: "); | |
long value = input.nextLong(); | |
System.out.println("The sum of digits for " + value + | |
" is " + sumDigits(value)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CountUppercaseLetter_Exercise05_50 { | |
public static void main(String[] args) { | |
java.util.Scanner input = new java.util.Scanner(System.in); | |
System.out.print("Enter a string: "); | |
// Create a string with user input | |
_______________________________________ | |
//Create a variable of int type called total | |
____________________ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class CountVowelsAndConsonantsExercise_05_49 { | |
public static void main(String[] args) { | |
Scanner input = new Scanner(System.in); | |
System.out.print("Enter a string: "); | |
//Create string input form user | |
_____________________________ | |
int countVowels = __; | |
int countConsonants = __; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class ProcessStringExercise_05_48 { | |
public static void main(String[] args) { | |
Scanner input = new Scanner(System.in); | |
System.out.print("Enter a string: "); | |
_________________________________________ | |
Create a for loop that will look for each odd letter in the string. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class ReverseAStringExercise_05_46 { | |
public static void main(String[] args) { | |
Scanner input = new Scanner(System.in); | |
System.out.print("Enter a string: "); | |
__________________________________ | |
String result = ""; | |
for (int i = __; ___ < s.length(); ____) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FindSalesAmountExercise_05_39 { | |
/** Main method */ | |
public static void main(String[] args) { | |
// The commission sought | |
final double COMMISSION_SOUGHT = 25000; | |
final double INITIAL_SALES_AMOUNT = 0.01; | |
double commission = 0; | |
double salesAmount = INITIAL_SALES_AMOUNT; | |
do { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class LotteryWithTwoDigits_5_32 { | |
public static void main(String[] args) { | |
// Generate the first digit | |
__________________ = ____________________ | |
// Generate the second digit | |
int second = (int)(Math.random() * 10);; | |
while (first == _________) { | |
second = (int)(Math.random() * 10); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DisplayFirstDayOfMonth_05_28 { | |
public static void main(String[] args) { | |
java.util.Scanner input = new java.util.Scanner(System.in); | |
// Prompt the user to enter input | |
System.out.print("Enter a year: "); | |
int year = input.nextInt(); | |
System.out.print("Enter the first day of the year: "); | |
int firstDay = input.nextInt(); |