Need help with your Discussion

Get a timely done, PLAGIARISM-FREE paper
from our highly-qualified writers!

glass
pen
clip
papers
heaphones

4 simple tasks for intro to Java

4 simple tasks for intro to Java

4 simple tasks for intro to Java

Question Description

Task 1 – Multiple choice, string comparison (case insensitive),

Java file: HW3_Faces.java
Write a program that allows the user to print one of 4 possible faces. The options for faces are:

  • bo – Bold, Open eyes
  • bc – Bold, Closed eyes
  • ho – Hat, Open eyes
  • hc – Hat, Closed eyes

The program should be case insensitive, meaning that it will work well with both upper case and lower case letters or a combination of those. E.g.all these are valid choices: bo, BO, bO, Bo.
Hints:

  • You may want to use the s.toLowerCase() or s.toUpperCase() where s is a string. Keep in mind that they do not modify s, but they return a new string.
  • Do NOT use == to compare strings.
  • Develop your program gradually.
------- Sample run 1Enter face choice (bo/bc/ho/hc): ho    _______ __|_______|___   | o   o |   |   ^   |      -  /     -----Bye ------- Sample run 2   (Note: case insensitive: works for Uppercase letters as well)Enter face choice (bo/bc/ho/hc): Ho    _______ __|_______|___   | o   o |   |   ^   |      -  /     -----Bye------- Sample run 3Enter face choice (bo/bc/ho/hc): bo    -------   /          | o   o |   |   ^   |      -  /     -----Bye------- Sample run 4Enter face choice (bo/bc/ho/hc): BC    -------   /          | -   - |   |   ^   |      -  /     -----Bye------- Sample run 5Enter face choice (bo/bc/ho/hc): hc    _______ __|_______|__   | -   - |   |   ^   |      -  /     -----Bye 

Task 2

File: HW3_Wiki.java
WIkipedia pages have a specific webpage address. Any address starts with https://en.wikipedia.org/wiki/ and then continues with the topic for that page e.g. Computer_science, Java_(programming_language). See examples below:

https://en.wikipedia.org/wiki/Computer_sciencehttps://en.wikipedia.org/wiki/Java_(programming_language)https://en.wikipedia.org/wiki/Imagine_Dragons 

Write a program that reads a string from the user. If it is a valid wikipedia webpage, it extracts and prints the topic for that page. If it is not a valid address it prints the message Not a valid wikipedia webpage address.
Hint: How can the fact that all valid addresses start with the same text before the topic name help you extract the topic name?
You do NOT need to handle the case where the webpage address is correct, but it is written in uppercase letters. You can assume it is all lowercase.

---- Sample run 1 This program will extract the topic from a valid Wikipedia webpage address.Enter a web address: https://en.wikipedia.org/wiki/Computer_scienceTopic: Computer_scienceBye.---- Sample run 2 This program will extract the topic from a valid Wikipedia webpage address.Enter a web address: http://vlm1.uta.edu/~alex/courses/1310/homework/hw02.htmlNot a valid wikipedia webpage address.Bye.---- Sample run 3  (note that even though this is a special case, you should NOT need to do anything special about it. The code that works for normal cases will just for this as well.)This program will extract the topic from a valid Wikipedia webpage address.Enter a web address: https://en.wikipedia.org/wiki/Topic: Bye.

Task 3 – complex boolean expression or nested if-statements

Java file: HW3_Aries.java
Write a program that reads the month and the day from the user and prints whether or not someone born on that date is under the Aries astrological sign or not.
Anyone born between and including March 21 and April 19 is Aries.
You can assume that the month and day are given as integer numbers (e.g. do not worry about user enterring March)
Hint: write the condition for an Aries date in March. Write the condition for April. Put these two together.

--- Sample run:Enter the month: 3Enter the day: 21Aries.--- Sample run:Enter the month: 4Enter the day: 19Aries.--- Sample run:Enter the month: 3Enter the day: 27Aries.--- Sample run:Enter the month: 4Enter the day: 6Aries.--- Sample run:Enter the month: 3Enter the day: 40Not Aries.--- Sample run:Enter the month: 4Enter the day: -5Not Aries.--- Sample run:Enter the month: 2Enter the day: 27Not Aries.

Extra (for practice, not grade): recognize the month in other formats as well: Mar, March, 3, 03, Apr, April, 4, 04.


Task 4 – ‘long’ program, multiple step processing, non-trivial data manipulation, formatted printing, if-statements

Java file name: HW3_Bills.java
Write a program that asks the user for an amount and calculates and print the minimum number of bills of 20,10,5, and 1 needed to pay that amount.
In order to use the minimum number of bills, you must pay as many bills of 20 as possible, and then the largest number of bills of 10 and so on.
Logic/ Processing steps:

  • Compute and store the max number of bills of 20. Hint: this is the same as asking how many times can I fit 20 into my amount?
  • Compute the remaining amount. Hint: This is the remainder of dividing the amount by 20.
  • Compute and store the max number of bills of 10.
  • Compute the remaining amount.
  • Compute and store the max number of bills of 5.
  • Compute the remaining amount. Note that this amount (that could not be payed with 20,10 and 5) can only be payed with bills of 1, so this is how many bills of 1 are needed.
  • Print table formatted (aligned) as shown in the sample run. In particular the cells for the number of bills should have a width of 4 spaces. (E.g. see how the number of bills of 20 in sample run 1 (30) and in sample run 2 (3) do not miss align the table cells.)
  • Prints the total number of bills given (of any value).

Hints:

  1. You should save the number of each bills since you need to use it (to print) twice.
  2. A cell in the last row in the table will have nothing printed when the number of bills is 0 and a number otherwise. What Java instruction allows you to choose to do one action or another based on data?
  3. To ‘print nothing’ you can print an empty string (“”) or a string with just a space in it (” “).
  4. You can print a SINGLE line in Java with SEVERAL printf statements. It does not have to be a single printf.
    Consider using different printf() for the cell for each bill. So one printf will print ” 2|” and another will print ” 1|”, etc.
    Finally, for the last line, note that as you print the cell, you will have either a number or a space to print.

Grading:

  • 2 pts – prints message about what program does and gets user input.
  • 5 pts – total bills printed at the end: calcuate (4 pts), print (1 pts)
  • 4 pts – print table lines: horizontal lines (2 pts), vertical lines (2 pts)
  • 4pts – the 2-nd row of the table is formated. It reserves spaces in cells with numbers (especially for bills of 20)
  • 1pt – table header row
  • 12 pts – calculate and save count of each bill (12 pts: 3 pts per bill)
  • 6 points – print the last row with correct spaces instead off 0
  • 6 pts – program style: good variable names (2 pts), correct indentation (2pts) , comments (2pts)
--- Sample run 1:This program will calculate the minimum number of bills of 20,10,5, and 1 needed to pay a given amount.Enter the integer amount that you need to pay: 619------------------------------------| Bill value   |  20|  10|   5|   1|------------------------------------| Num of bills |  30|   1|   1|   4|------------------------------------| Num of bills |  30|   1|   1|   4|------------------------------------Total bills: 36Bye--- Sample run 2:This program will calculate the minimum number of bills of 20,10,5, and 1 needed to pay a given amount.Enter the integer amount that you need to pay: 74------------------------------------| Bill value   |  20|  10|   5|   1|------------------------------------| Num of bills |   3|   1|   0|   4|------------------------------------| Num of bills |   3|   1|    |   4|------------------------------------Total bills: 8Bye--- Sample run 3:This program will calculate the minimum number of bills of 20,10,5, and 1 needed to pay a given amount.Enter the integer amount that you need to pay: 2------------------------------------| Bill value   |  20|  10|   5|   1|------------------------------------| Num of bills |   0|   0|   0|   2|------------------------------------| Num of bills |    |    |    |   2|------------------------------------Total bills: 2Bye--- Sample run 4:This program will calculate the minimum number of bills of 20,10,5, and 1 needed to pay a given amount.Enter the integer amount that you need to pay: 25------------------------------------| Bill value   |  20|  10|   5|   1|------------------------------------| Num of bills |   1|   0|   1|   0|------------------------------------| Num of bills |   1|    |   1|    |------------------------------------Total bills: 2Bye

Try and do the final task first. All program output should match the sample runs exactly.

Have a similar assignment? "Place an order for your assignment and have exceptional work written by our team of experts, guaranteeing you A results."

Order Solution Now

Our Service Charter


1. Professional & Expert Writers: Eminence Papers only hires the best. Our writers are specially selected and recruited, after which they undergo further training to perfect their skills for specialization purposes. Moreover, our writers are holders of masters and Ph.D. degrees. They have impressive academic records, besides being native English speakers.

2. Top Quality Papers: Our customers are always guaranteed of papers that exceed their expectations. All our writers have +5 years of experience. This implies that all papers are written by individuals who are experts in their fields. In addition, the quality team reviews all the papers before sending them to the customers.

3. Plagiarism-Free Papers: All papers provided by Eminence Papers are written from scratch. Appropriate referencing and citation of key information are followed. Plagiarism checkers are used by the Quality assurance team and our editors just to double-check that there are no instances of plagiarism.

4. Timely Delivery: Time wasted is equivalent to a failed dedication and commitment. Eminence Papers are known for the timely delivery of any pending customer orders. Customers are well informed of the progress of their papers to ensure they keep track of what the writer is providing before the final draft is sent for grading.

5. Affordable Prices: Our prices are fairly structured to fit in all groups. Any customer willing to place their assignments with us can do so at very affordable prices. In addition, our customers enjoy regular discounts and bonuses.

6. 24/7 Customer Support: At Eminence Papers, we have put in place a team of experts who answer all customer inquiries promptly. The best part is the ever-availability of the team. Customers can make inquiries anytime.

We Can Write It for You! Enjoy 20% OFF on This Order. Use Code SAVE20

Stuck with your Assignment?

Enjoy 20% OFF Today
Use code SAVE20