Instructor Solutions Manual For Introduction To Java Programming And Data Structures, Comprehensive Version, 11th Edition
11th Edition
ISBN: 9780134671581
Author: Liang
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 6.4, Problem 6.4.8CP
Write method headers (not the bodies) for the following methods:
- a. Return a sales commission, given the sales amount and the commission rate.
- b. Display the calendar for a month, given the month and year.
- c. Return a square root of a number.
- d. Test whether a number is even, and returning true if it is.
- e. Display a message a specified number of times.
- f. Return the monthly payment, given the loan amount, number of years, and annual interest rate.
- g. Return the corresponding uppercase letter, given a lowercase letter.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Write method headers (not the bodies) for the following methods: a. Return a sales commission, given the sales amount and the commission rate. b. Display the calendar for a month, given the month and year. c. Return a square root of a number. d. Test whether a number is even, and returning true if it is. e. Display a message a specified number of times. f. Return the monthly payment, given the loan amount, number of years, and annual interest rate. g. Return the corresponding uppercase letter, given a lowercase letter.
Write a program that asks the user to enter an item’s wholesale cost and its markup percentage. It should then display the retail price for the item. For example: • If the wholesale cost is £3.00 and the markup percentage is 100%, the retail price will be £6.00 • If the wholesale cost is £5.00 and the markup percentage is 50%, the retail price will be £7.50. The calculation should be done by a method called CalculateRetailPrice in a class called RetailPricing. The method CalculateRetailPrice should the wholesale cost and markup percentage as arguments and returns the retail price. require to be in c#
Write a program that displays the income tax due on taxable income entered by the user. Have the user enter the tax in the main() method, and then call a calcTax() method to compute the tax. Print the value returned.
The calcTax() method should have one parameter - income - and return a double - tax.
The tax is calculated as follows:
Income
Tax Due
$0 - $50,000
5%
$50,000-$100,000
$2,500 + 10% of (income > $50,000)
> $100,000
$7,500 + 15% of (income > $100,000)
Chapter 6 Solutions
Instructor Solutions Manual For Introduction To Java Programming And Data Structures, Comprehensive Version, 11th Edition
Ch. 6.4 - What are the benefits of using a method?Ch. 6.4 - Prob. 6.4.2CPCh. 6.4 - How do you simplify the max method in Listing 6.1...Ch. 6.4 - Prob. 6.4.4CPCh. 6.4 - Prob. 6.4.5CPCh. 6.4 - Prob. 6.4.6CPCh. 6.4 - Prob. 6.4.7CPCh. 6.4 - Write method headers (not the bodies) for the...Ch. 6.4 - Identify and correct the errors in the following...Ch. 6.4 - Prob. 6.4.10CP
Ch. 6.5 - Prob. 6.5.1CPCh. 6.5 - Identify and correct the errors in the following...Ch. 6.5 - Prob. 6.5.3CPCh. 6.5 - Prob. 6.5.4CPCh. 6.6 - Prob. 6.6.1CPCh. 6.6 - Prob. 6.6.2CPCh. 6.7 - What is hexCharToDecimal ( B)) ? What is...Ch. 6.8 - What is method overloading? Is it permissible to...Ch. 6.8 - What is wrong in the following program? public...Ch. 6.8 - Given two method definitions, public static double...Ch. 6.9 - Prob. 6.9.1CPCh. 6.9 - What is the scope of a local variable?Ch. 6 - (Math: pentagonal numbers) A pentagonal number is...Ch. 6 - (Sum the digits in an integer) Write a method that...Ch. 6 - (Palindrome integer) Write the methods with the...Ch. 6 - (Display an integer reversed) Write a method with...Ch. 6 - (Sort three numbers) Write a method with the...Ch. 6 - (Display patterns) Write a method to display a...Ch. 6 - (Financial application: compute the future...Ch. 6 - (Conversions between Celsius and Fahrenheit) Write...Ch. 6 - Prob. 6.9PECh. 6 - (Use the isPrime Method) Listing 6.7,...Ch. 6 - (Financial application: compute commissions) Write...Ch. 6 - (Display characters) Write a method that prints...Ch. 6 - (Sum series) Write a method to compute the...Ch. 6 - (Estimate ) can be computed using the following...Ch. 6 - (Financial application: print a tax table) Listing...Ch. 6 - Prob. 6.16PECh. 6 - Sections 6.10 and 6.11 6.17 (Display matrix of 0s...Ch. 6 - (Check password) Some Websites impose certain...Ch. 6 - (Triangles) Implement the following two methods: /...Ch. 6 - (Count the letters in a string) Write a method...Ch. 6 - (Phone keypads) The international standard...Ch. 6 - (Math: approximate the square root) There are...Ch. 6 - (Occurrences of a specified character) Write a...Ch. 6 - (Display current date and time) Listing 2.7,...Ch. 6 - Prob. 6.25PECh. 6 - (Palindromic prime) A palindromic prime is a prime...Ch. 6 - (Emirp) An emirp (prime spelled backward) is a...Ch. 6 - (Mersenne prime) A prime number is called a...Ch. 6 - (Twin primes) Twin primes are a pair of prime...Ch. 6 - (Game: craps) Craps is a popular dice game played...Ch. 6 - (Financial: credit card number validation) Credit...Ch. 6 - (Game: chance of winning at craps) Revise...Ch. 6 - (Current date and time) Invoking System....Ch. 6 - (Print calendar) Programming Exercise 3.21 uses...Ch. 6 - (Geometry: area of a pentagon) The area of a...Ch. 6 - (Geometry: area of a regular polygon) A regular...Ch. 6 - (Format an integer) Write a method with the...Ch. 6 - (Generate random characters) Use the methods in...Ch. 6 - (Geomentry: point position) Programming Exercise...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Is left recursion a problem for LR parsers?
Concepts of Programming Languages (11th Edition)
Write out the header of a for-each loop to process an ArrayList called tracks. Don't worry about the loop's bod...
Objects First with Java: A Practical Introduction Using BlueJ (6th Edition)
3.12 (Date Create a class called Date that includes three pieces Of information as data
members—a month (type ...
C++ How to Program (10th Edition)
Define a class named Doctor whose objects are records for a clinics doctors. Derive this class from the class P...
Java: An Introduction to Problem Solving and Programming (8th Edition)
Consider the adage Never ask a question for which you do not want the answer. a. Is following that adage ethica...
Experiencing MIS
When placed at the end of an IfThenElself statement, this provides default action when none of the ElseIf state...
Starting Out With Visual Basic (7th Edition)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- construct 2 methods: Void input() and void maxNum(). The input method should allow user to input 3 integers while maxNum method should be able to generate the highest number. Display the highest number in your program.arrow_forwardWrite a method using the following header that determines whether the day of the month is a working day and will return "Working Day" and "Non-working Day" accordingly. The method accepts two parameters: day of week for the 1" day of the month and day of the month (you can assume each month has exactly 30 days). If the given day of the month is not a valid number, the method should return "Incorrect Day of Month". If the given initDayOfWeek is not a valid number, the method should return "Incorrect Initial Day of Week" If both numbers are incorrect, only return “Incorrect Initial Day of Week". public static String isWorkingDay (int initDayOfWeek, int dayNum) (To make the day of week easier to be represented in the program, we use int number 0 to represent Sunday, 1 to represent Monday, 2 to represent Tuesday ... and 6 to represent Saturday) Examples: isWorkingDay (0, 1) returns "Non-working Day". (As 1" day of the month is Sunday) isWorkingDay (1, 2) returns "Working Day" . (As 1ª day…arrow_forward6. Write a method that reads three strings from the keyboard. Although the strings are in no particular order, display the string that would be second if they were arranged lexicographically. 7. Write a method that reads a one-line sentence as input and then displays the following response: If the sentence ends with a question mark (?) and the input contains an even number of characters, display the word Yes. If the sentence ends with a question mark and the input contains an odd number of characters, display the word No. If the sentence ends with an exclamation point (!), display the word Wow. In all other cases, display the words You always say followed by the input string enclosed in quotes. Your output should all be on one line. Be sure to note that in the last case, your output must include quotation marks around the echoed input string. In all other cases, there are no quotes in the output. Your program does not have to check the input to see that the user has entered a…arrow_forward
- A primitive variable is passed from one method to another method by in Java. pass by value O pass by referencearrow_forwardSuppose you have a certain amount of money in a savings account that earns monthly interest, and you want to calculate the amount that you will have after a specific number of months. The formula is: F=P x (1 + i)t F: future value of the account after the specified time period P: present value of the account i: monthly interest rate t: the number of months Write a program (by using two methods) that prompts you to enter the account’s present value, monthly interest rate, and the number of months that the money will be left in the account. The program should pass these three values to a sub-method. Finally, the program should display the account’s future value. Different methods using java programmingarrow_forwardWrite a method that returns the number of days in ayear using the following header:public static int numberOfDaysInAYear(int year)Write a test program that displays the number of days in the years between 2014and 2034.arrow_forward
- a. Plan the logic for an insurance company program to determine policy premiums. The program continuously prompts the user for an insurance policy number. When the user enters an appropriate sentinel value, end the program. Call a method that prompts each user for the type of policy needed—health or auto. While the user’s response does not indicate health or auto, continue to prompt the user. When the value is valid, return it from the method. Pass the user’s response to a new method where the premium is set and returned—$550 for a health policy or $225 for an auto policy. Display the results for each policy. b.Modify Exercise 9a so that the premium-setting method calls one of two additional methods—one that determines the health premium or one that determines the auto premium. The health insurance method asks users whether they smoke; the premium is $550 for smokers and $345 for nonsmokers. The auto insurance method asks users to enter the number of traffic tickets they have received…arrow_forwardTask 1: Write a Java Program which will determine whether a number is even or odd. Take the number as an input from the user. Perform the checking in a separate method other than main method. Print the results in main method. Task 2: Find out the area of three geometric shape: Circle, Triangle, Square. Give the user an option to select which geometric shape's area he/she wants to find out. Based on the choice take necessary input and find out the result. Use different area method for each geometric shape. Print the result in main method.arrow_forwardWrite a program that asks the user to enter a character. Then pass the character to the following methods. a) isVowel() – returns true if the character is a vowel b) isConsonant() – returns true if the character is a consonant c) changeCase() – if the character is lower case then change it to upper case and if the character is in upper case then change it to lower case. Example output is given below: Enter a character a a is a vowel a is not a consonant a is equivalent to A Note: Java represents character using Unicode encoding and ‘A’ to ‘Z’ is represented by numbers 65 to 90 and ‘a’ to ‘z’ is represented by numbers 97 to 122. So to convert ‘A’ to ‘a’ you need to add (97-65) to A and then cast it to Character type since the addition will change its type to integer. You can use the following code to read a character from console. When you call charAt(i) method for any String it returns the character at index i. The index of first character is 0, the index of…arrow_forward
- Task 03: Read the concept of Binomial coefficient given in chapter-6. Write a method that takes two parameters n and k and returns the value of Binomial Coefficient C(n, k). For example, your function should return 20 for n = 6 and k = 3, and it should return 35 for n= 7 and k = 4. ( confirm it through the Pascal's triangle as given below). 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 15 10 10 5 1 15 (20) 15 6 1 1 7 21 35 (35 21 7 1 1arrow_forward1. Write a program that will ask the a user a number between 1 to 7. 2. Print out the equivalent day of the week for that number. Starting 1 for Sunday, 2 for Monday and etc. 3. Use at least 1 user-defined method aside from your main method in writing a code for this problem (Input number: Expected Output: )arrow_forwardWrite a method that finds the average of 4 double numbers. The parameters consist of 4 double numbers read in main and then passed to the method. The method will then return the average to main which will display the value to the user. public static double avg (double a, double b, double c, double d)arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
CPP Function Parameters | Returning Values from Functions | C++ Video Tutorial; Author: LearningLad;https://www.youtube.com/watch?v=WqukJuBnLQU;License: Standard YouTube License, CC-BY