Java | JSP | JSF Answers

Questions: 4 418

Answers by our Experts: 3 943

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

Java

Anyone know how to make a Switch statement to ask the user for a number and then convert it to a single Chinese character and print it out?



I just need a small example so I can get started. So far I got the unicode for Chinese characters.

4E8C = 1 in chinese
4E09 = 2
link list in java of length,n.a number,m is given and the program needs to on the mth node remove the node and continue doing so until the last node remains.
Write a method
int bumpMe(int price, int increase, Boolean updown)
That accepts a price in dollars and returns a new price rounded to the nearest dollar, after increasing /decreasing price by increase percent. If updown is true then you should increase the price ;otherwise, decrease the price. Write an appropriate main(…)method to test bumpMe(…)
I have to implement a class which represents a 2-d geometrical point and for my main program it is: public static void main(String[] args){
Point p=new Point();
System.out.println(p);
Point q=new Point(3,4);
System.out.println(p);
System.out.println(distance(p,q));
p.translate(2,3);
q.SetLocation(7,15);
System.out.println(p.distance(q));
i am having trouble figuring out what other codes to enter to make this work, the output should be:
Point [0.0,0.0]
Point[3.0,4.0]
5.0
13.0
HELP?
How long does it take to get a price quote normally?
determineDayOfWeek():
o Accepts three integer values for day, month and year as the parameters.
o Use the steps given below to determine the day of a week and return the corresponding string
Q3 class:
This class should have at least the following methods:
(i) main():
o Prompts the user for the date in dd/mm/yyyy format and reads the input from the keyboard.
o Calls the method inputValidation() (describe in (ii) below) to validate the date. If the date is valid, calls the method determineDayOfWeek() (describe in (iii) below) to determine the day of the week and display it. Otherwise, catch the exception thrown from the method and display the exception message.
(ii) inputValidation():
o Accepts the three integer values for day, month and year as the parameters.
o Checks whether these values form the correct date. Returns true if so.
[ Correct date has the year between 1900 and 2999, month between 1 and 12 and day according to the month: 30 days for Apr, Jun, Sept, Nov; 28 days for Feb in non-leap year and 29 days for Feb in leap year; 31 days for the other months. A year is a leap year if it is divisible by 4 but not divisible by 100 or divisible by 400. ]
import java.util.Scanner;
import java.text.NumberFormat;
import java.text.DecimalFormat;
/**
* Write a description of class CurrencyUI here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class CurrencyUI
{
/**
* An example of a method - replace this comment with your own
*
*/
public double runConversions()
{
// put your code here
double input;
String input2;

System.out.println("Welcome to the currency converter.\n");
System.out.print("Enter the amount of American dollars to convert > ");

input = scan.nextLine();

System.out.println("Mexican Pesos [P]/nEuropean Euros [E]\nChinese Yuan [Y]\nCanadian Dollars [D]\n\nEnter the currency to convert to > ");

input2 = scan.nextLine();

System.out.println(newConversion());
}
}
Why won't this compile?
Design and implement a class called DecToBinArray and write a test program called DecToBinArrayTest.

DecToBinArray is utility class that converts a nonnegative decimal number between 0 and 255 into an array of 0's and 1's. For example, you should be able to do the following:
DecToBinArray arr = new DecToBinArray(120);
arr.convert();
System.out.println(arr);

DecToBinArrayTest should also implement toString() method properly so that the above code snippet print out the standard output 01111000.
NOTE: that the length of the array used in DecToBinArray is always 8 since integers from 0 to 255 can be represented with 8 bits.

DecToBinArrayTest reads a string of digits representing a nonnegative integer from 0 to 255. you may read a line of text from the standard in using the following:

BufferedReader in = new BufferedReader(new InputStreamReader(System.in))
I have to write a java program that basically convert decimal to binary and print it out using array. I have a function to reads in an input from the users and I'm not sure how to take that input and have it store in my function I have to convert it to binary. Below is a a snippet of my program with 120 being hard coded into the program just for testing purposes, but I don't know how to get .convert to take the argument of what the user inputs from the keyboard. need any more info please let me know.

DecToBinArray arr = new DecToBinArray();
arr.convert(120);
LATEST TUTORIALS
APPROVED BY CLIENTS