Chat with us, powered by LiveChat Java Programming | WriteDemy

Question Description

Homework:

Prompt the user for an Integer and one of the following Strings: convert, add, or subtract.

If the user enters "convert" or "Convert", multiply the number entered by 5 then divide the result by 9.If the user enters "add" or "Add", add 15.8549 to the number. If the user enters "subtract" or "Subtract", subtract 1.0001 from the number then square the result.

Display the result with at most two places after the decimal point. Include the function chosen in the printout.

If anything other than convert, add, or subtract is entered print an error message and stop.

5.24 Lab7Num3

Write a program that accepts a word from the keyboard (a string) and converts it into Pig Latin. Output the word in Pig Latin. These are the rules for conversion: Look at the first character in the word, if it is a vowel, just add "way" to the end of the word Otherwise move the consonant to the end and add "ay". For example: “apple” becomes “appleway” and “cat” becomes “atcay”

import java.util.Scanner;

public class Lab7Num3 {

public static void main(String[] args) {

Scanner keyboard = new Scanner (System.in);

//get phrase

System.out.println("Enter a word in lowercase");

}

}

5.23 Lab7Num2

Suppose you work for an online service that provides a bulletin board for its users. You would like to filter out profanity and consider the words “cat”, “dog”, “llama” to be profane. Write a program that reads a phrase from the keyboard and tests whether the string contains one of these words. Output “contains profanity” or “doesn’t contain profanity”. If the input is: “I have a dog” your program should output “contains profanity”.

import java.util.Scanner;

public class Lab7Num2 {

public static void main(String[] args) {

Scanner keyboard = new Scanner (System.in);

String str;

System.out.println("Enter a phrase");

if ()

System.out.println("contains profanity");

else

System.out.println("does not contain profanity");

}

}

5.22 Lab7Num1

An integer is divisible by another if the remainder after division is zero. For example, 10 % 5 is zero, but 7 % 5 is not. Write a program that accepts two integers from the keyboard and outputs whether the first one is divisible by the second.

import java.util.Scanner;

public class Lab7Num1 {

public static void main(String[] args) {

Scanner keyboard = new Scanner (System.in);

int num1;

int num2;

System.out.println("Enter two integers");

if()

System.out.println(num1 + " is divisible by " + num2);

else

System.out.println(num1 + " is not divisible by " + num2);

}

}

Our website has a team of professional writers who can help you write any of your homework. They will write your papers from scratch. We also have a team of editors just to make sure all papers are of HIGH QUALITY & PLAGIARISM FREE. To make an Order you only need to click Ask A Question and we will direct you to our Order Page at WriteDemy. Then fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.

Fill in all the assignment paper details that are required in the order form with the standard information being the page count, deadline, academic level and type of paper. It is advisable to have this information at hand so that you can quickly fill in the necessary information needed in the form for the essay writer to be immediately assigned to your writing project. Make payment for the custom essay order to enable us to assign a suitable writer to your order. Payments are made through Paypal on a secured billing page. Finally, sit back and relax.

Do you need an answer to this or any other questions?

About Writedemy

We are a professional paper writing website. If you have searched a question and bumped into our website just know you are in the right place to get help in your coursework. We offer HIGH QUALITY & PLAGIARISM FREE Papers.

How It Works

To make an Order you only need to click on “Place Order” and we will direct you to our Order Page. Fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.

Are there Discounts?

All new clients are eligible for 20% off in their first Order. Our payment method is safe and secure.

Hire a tutor today CLICK HERE to make your first order