Explanation of Solution
Program:
File name: “InputCharacterInfo.java”
//Import necessary header files
import java.util.Scanner;
//Define a class named InputCharacterInfo
public class InputCharacterInfo
{
//Define main method
public static void main(String[] args)
{
//Create an object to the Scanner class
Scanner sc = new Scanner(System.in);
//Prompt the user to enter a character
System.out.println("Enter char: ");
char aChar = sc.nextLine().charAt(0);
//Tests if character is uppercase
if (Character.isUpperCase(aChar))
{
//Print the result
System.out.println(aChar + " is uppercase");
}
//Else condition
else
{
//Print the result
System.out.println(aChar + " is not uppercase");
}
//Tests if character is lowercase
if (Character.isLowerCase(aChar))
{
//Print the result
System.out.println(aChar + " is lowercase");
}
//Else condition
else
{
//Print the result
System.out.println(aChar + " is not lowercase");
}
//Returns the uppercase equivalent of the character
aChar = Character...
Want to see the full answer?
Check out a sample textbook solutionChapter 7 Solutions
Java Programming, Loose-leaf Version
- The fields below repeat for each customer: o Customer name (String)o Customer ID (numeric integer) o Bill balance (numeric)o EmailAddress (String)o Tax liability (numeric or String) The customers served by the office supply store are of two types: tax-exempt or non-tax- exempt. For a tax-exempt customer, the tax liability field on the file is the reason for the tax exemptions: education, non-profit, government, other (String). For a non-tax exempt customer, the tax liability field is the percent of tax that the customer will pay (numeric) based on the state where the customer’s business resides. Program requirements: From the information provided, write a solution that includes the following: A suitable inheritance hierarchy which represents the customers serviced by the office supply company. It is up to you how to design the inheritance hierarchy. I suggest a Customer class and appropriate subclasses.. For all classes include the following: o Instance variables o…arrow_forwardJAVA PPROGRAM ASAP Hypergrade does not like this program because it says 2 out of 7 passed and take out the extra \n from the program. Please Modify and change this program ASAP BECAUSE IT IS HOMEWORK ASSIGNMENT so it passes all the test cases. The program must pass the test case when uploaded to Hypergrade. Also, for test cases 1-4 it wants only to input Please enter the file name or type QUIT to exit: then input the file and display the Total number of words. For test cases 5 and 7 it wants to only to input Please enter the file name or type QUIT to exit then input input5.txt and then display File: input5.txt does not exist.\n then display Please enter the file name again or type QUIT to exit:\n then type input1.txt to display the total number of words or type quit to exit the program. For test case 6 it wants only to Please enter the file name again or type QUIT to exit:\n then type quit to exit the porgram. import java.io.File;import java.io.FileNotFoundException;import…arrow_forwardPython Coding-(On Pycharm Community Edition) Create a mini-lottery with TEXT ticket. The user is going to save three numbers in a text file - those three numbers are from 1-9. In Python, create a program that reads those three numbers from the text file (ticket) Use a random number generator to draw three random numbers Compare the text ticket and the random numbers. If they match number (see below), output the prize The numbers can be in any order the random numbers can be duplicates, so be careful how you count! This work in a similar way to mini-assignment number 48 - but you DO NOT have to write to a text file. Have the user enter the numbers into the text file. Append the numbers read from the text file to a list read each number from the list and compare it to the randomly generated numbers you come up with One number match - free ticket Two numbers match - $2.00 Three numbers match - $10.00 -you don't have to complete bonus, it would be great if you could-…arrow_forward
- Create methods "read" and "write" methods to handle the input and output to files. in Javaarrow_forwardModify the code below. The output must not have spaces between the comma and the number. What is the time complexity before and after modifying the code?arrow_forwardAssignment: Check the Sample run first, then carefully read the instructions and write aprogram that prompts the user for first name, last name, then secret number. The output willgenerate a default email address and a default password. 1. The main method will do the following:• Asks the user for first name, last name, and secret number using Scanner. (first lettercan be in upper case)• Call defaultInfo(String, String) method to PRINT default Kean email address.• Call defaultInfo(String, int) method to PRINT default Kean password.• Note: You are using overloaded methods (i.e., same method name with differentparameter lists) 2. Write an overloaded method, defaultInfo, which does the following:• public static void defaultInfo(String firstName, String lastName) [Note:you can use your own variable name]‒ print default email address all in low caps: concatenate first letter offirstName, full lastName, and @gmail.com. [Hint: string.charAt(index),string.toLowerCase()]• public static void…arrow_forward
- Fix the error(s) code in the picture 2, compile and output the results as shown in command prompt below.arrow_forward8.In this exercise you will create a program that will be used in a digital library to format and sort journal entries based on the authors last name. Each entry has room to store only the last name of the author. Begin by removing the first name "Isaac" from the string variable journal_entry_1 by using the string function erase. Do not forget to also remove the whitespace so that the string variable journal_entry_1 will then contain the string "Newton" with no whitespaces. The journal entries should be sorted alphabetically based on the authors last name. For example, the last name "Brown" should come before the last name "Davis" Create an if statement so that if the last name contained within journal_entry_2 is alphabetically less than the last name contained within journal_entry_1, then the string values are swapped using the string function swap. You may use either of the comparison operators < > in the if statement but remember that following ASCII, "A" is lexicographically…arrow_forwardWrite an application that determines whether a phrase entered by the user is a palindrome. A palindrome is a phrase that reads the same backward and forward without regarding capitalization, spaces or punctuation. And it will allow the user to enter as many phrases as he likes after each iteration.arrow_forward
- Assignment: Use OOP to implement certain details and requirements for the assignment. The lab is about donkey kong characters and their statistics and information which is provided on a Monkey.txt file that must be read in. Some information of monkeys is below which will be used: Most species are arboreal, using all four limbs to leap from tree to tree. They can sit upright and stand erect. Most species run along branches rather than swinging arm over arm like apes. Monkeys are highly social omnivores, organized in clans as large as several hundred individuals headed by an old male. The underlines are at least behavior (member functions) that you are asked to add to your OOP program such as Leap(string, string), Sit(), Walk(), Swing()... Here are some descriptions of a monkey that must apply to your program. The information from the Monkey.txt file will be used along with the format below. Name Sit Walk Swing Leap Jump Banana Year…arrow_forward***Please write code suitable for Myprogramminglab below: If you have downloaded the source code from this book's companion web site, youwill find the following files in the Chapter 07 folder:• GirlNames.txt--This file contains a list of the 200 most popular names given togirls born in the United States from the year 2000 through 2009.• BoyNames.txt--This file contains a list of the 200 most popular names given toboys born in the United States from the year 2000 through 2009.Write a program that reads the contents of the two files into two separatelists, allows a user to input either a girl's name, a boy's name, orboth, then tells the user whether the name(s) was/were popular between 2000 and2009.First, the program should prompt the user to choose a girl's name, a boy's name,or both by entering either 'girl', 'boy', or 'both.'Once they have chosen, they should be able to input a name. If the name wasa popular name, like Jacob or Sophia, the program should print "Jacob was apopular…arrow_forwardWrite the code completely.arrow_forward
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT