Translator Program That Will Convert English To Custom Binary

Aug 23, 2014

I am trying to make a translator program that will convert english to my custom binary. It works going from english to binary, but not going from binary to english.

import java.util.Scanner;
public class Translator
{
public static void main ( String [] args ) {
Scanner input = new Scanner( System.in );
System.out.print( "Would you like to convert English to Binary (yes or no)? " );
String answer = input.nextLine();

[Code] .....

View Replies


ADVERTISEMENT

Series Of Errors From English To Morse Code Translator

Jul 26, 2014

So I've been writing a program that converts user input from English to Morse Code and vice versa.

Here's my code:

public class Project1 {
private final static String [] English = { "a","b","c","d","e","f","g","h","i","j","k","l", "m","n","o","p", "q","r","s","t","u","v","w","x","y","z", " ","1","2","3","4","5","6","7","8","9","0"};
private final static String [] Morse = { ".-", "-...", "-.-/>/>/>/>.", "-..", ".", "..-.", "--.", "....", "..",".---", "-.-/>/>/>/>", ".-..", "--", "-.", "---", ".--.", "--.-/>/>/>/>", ".-.", "...", "-","..-","...-" , ".--" ,"-..-","-.-/>/>/>/>-", "--..", "|", ".----", "..---", "...--", "....-", ".....", "-....","--...","---..", "----.", "-----" };

public static void main( String [] args ) {
int n = Input.getInt( "Enter 1 for Morse to English, 2 for English to Morse." );
switch ( n ) {

[Code] ....

When I compile my program, I get the error message: "illegal start of expression" at my toEnglish and toMorse methods, as well as " ';' expected " at the same place.

View Replies View Related

Program To Convert Binary To Decimal

Oct 13, 2014

I'm working on creating the Binary to Decimal program . hat is wrong with this part of my code. Why does it not take you into the loop.

import java.util.Scanner;
public class question5 {
public static void main(String[] args) {
System.out.println("Enter a Binary number. "); // collect
Scanner keyb = new Scanner(System.in); //

[Code] ....

View Replies View Related

Api That Convert Speech To Text But Complete English Not Predifined Words Only

Oct 16, 2014

java api that convert speech to text but complete english not predifined words only.

View Replies View Related

Invalid Type And Syntax Error For Translator Program

Apr 5, 2015

Getting the following error at line 13.

Multiple markers at this line - void is an invalid type for the variable loadDictionaryFromFile - Syntax error on token ")", ; expected - Syntax error on token "(", ; expected

Line 13 starts public void load....

Code:

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.Scanner;
public class PirateTranslator
{
public static void main(String[] args)

[Code] .....

View Replies View Related

Convert String To Custom Object

Nov 15, 2014

I woud like to convert a string(which is in an array) to a custom object.

Also, if I have different custom objects, will it be ok if I use

ArrayList<Object> o = new ArrayList<>();?

View Replies View Related

How To Implement Collections Binary Search Method On ArrayList Of Custom Objects

May 11, 2012

I'm doubted regarding the implementation of Collections.binarySearch() method on an ArrayList of objects of a custom class Movie.

Here is the movie class :

public class Movie implements Comparable<Movie> {
String movieName;
String rating;
String director;
String theme;

[Code] .....

The sort/binarySearch in searchByMovieName function is done with natural sorting (and Comparable Interface in Movie class). I mean no comparators involved here. And the comparator that I used for sorting/binarySearching on Movies Director attribute in searchByMovieDirector function is :

public class MovieDirectorComparator implements Comparator<Movie> {
public int compare(Movie movie1, Movie movie2) {
return movie1.getDirector().compareToIgnoreCase(movie2.getDirector());
}
}

But I was not able to implement binarySearch ?? How to implement the binarySearch here. I have google to see only binarySearch working on Arrays or probably ArrayList of String only, but not on ArrayList of custom objects.

View Replies View Related

Convert Binary To Decimal Such As Bin

Sep 20, 2014

I am having an issue with my program. It is supposed to convert from a binary number to a decimal number such as bin 101 = dec 5. my first and foremost issue is that when I use System.out.println(parseBin("101")); it returns 5 as it should. However when I change 101 to 1013 it returns 13??? Why is this happening and why are my exceptions not catching the issue?

//import java.util.Scanner;
public class BinaryFormatException {
public static void main(String[] args) throws BinFormatException{
System.out.println(parseBin("1013"));
//Scanner input = new Scanner(System.in);
//System.out.println("Please enter a binary number using 1's and 0's: ");
//String binString = input.nextLine();

[Code] ....

View Replies View Related

Java Program To Translate English Into Pirate - Word Pair Class

Apr 5, 2015

I am making a java program that translates English into Pirate. I need working with the Word Pair class. I'm not sure what needs to be passed to the default constructor. And how to do the method that will take the words and pair them. here is my code and the dictionary file

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.Scanner; 
public class PirateTranslator {
public static void main(String[] args)
 
[Code] .....

View Replies View Related

Program To Read Input Of Morse Code And Then Produce Output Of English

Aug 25, 2014

I'm having some trouble with getting this program to read an input of morse code and then produce an output of English. When typing in morse code for the phrase 'the string', the output looks something like this:

- .... .
t
h
... - .-. .. -. --.
s
t
r
i
n

The English-->Morse works just fine.

import java.util.Scanner;
public class project1
{
static final String[] alpha = {
"a", "b", "c", "d", "e", "f", "g", "h", "i",
"j", "k", "l", "m", "n", "o", "p", "q", "r",
"s", "t", "u", "v", "w", "x", "y", "z", " "

[Code] .....

View Replies View Related

Input Binary Value And Convert It Into Decimal And Vice Versa

Jan 9, 2015

I am new to java programming and using bluej for programming and i have tried this question what i have have given in title ... How to do the following question without using strings.

Write a java program to input a binary value and convert it into decimal and Vice Versa. Without using String. Please make it for blue j format.

View Replies View Related

Packaging Custom Library In Java Program

Jan 29, 2014

I have a custom library I made to make things easier for myself. I used it in a small program in NetBeans and it works fine. When I try to clean and build, it says it can't find the methods from my Library class. How do I get the library packaged into the jar?

View Replies View Related

GUI Java Program - Hex To Binary Converter

Mar 11, 2014

This code is for a GUI Java program that is supposed to convert back and fourth between two numbering systems. For example, binary to decimal or decimal to binary. I have created methods for some of the conversions however, I could successfully develop a method to convert from hex to binary. If you plan to run it to see what happens to the current method that I made please know that in the GUI the north end from left to right is as follows.

The textfield is for user entry of any type of data. The first combobox is for the user specifying to the program what type of data he or she entered. The second combobox is for the user to choose what he wants that data converted to. The button is to convert it. The south side has a textarea that gives out the results. Please note that only some of the conversions work so far. There are comments in the code to label which methods do what converisons. Need to find a method that will convert from hex to binary, what is wrong with the current method.
 
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
 
[Code] .....

View Replies View Related

Program To Convert Temperature

Apr 24, 2014

Write a program that will provide temperature conversions between degrees Fahrenheit and degrees Celsius. Provide a method that will take an argument representing a temperature in Fahrenheit degrees and return the equivalent temperature in degrees Celsius. Also provide a method that will take an argument representing a temperature in degrees Celsius and return the equivalent temperature in degrees Fahrenheit. Conversion formulas are as follows: F = 9./5. * C + 32, C = 5./9. * ( F - 32 ), where F = Fahrenheit temperature and C = Celsius temperature. You must prompt for input using the Input class methods that are provided as a download for this unit.

I have two questions, 1st is why won't I get an output from my program when I run it? 2nd is how do I prompt for input using the Input class methods downloaded? The downloaded files are in .class form, and won't show any output when I run them.My code is:

import java.util.*;
public class temp
{
public static void main ( String [] args )
{
Scanner in = new Scanner(System.in);

[code]...

View Replies View Related

Java Binary Encoder And Decoder Program

Aug 2, 2014

I have made a Java Binary Encoder and Decoder program and, to date, this is the program I have spent the most time developing.

I have ran Alpha tests to check the functionality is correct and it appears to work well. However I am more interested in the quality of my code ,

The code can be found over at: [URL] ....

View Replies View Related

Writing Binary Search Program And Keep Getting Errors

Feb 24, 2014

Java Code:

public class Search
{
public static final int NOT_FOUND = -1;
public static int binarySearch( int [ ] a, int x )
{
int low = 0;
int high = a.length - 1;
int mid;
while ( low <= high )

[Code] ....

I keep getting illegal start of expression at ={-3,10,5,24,45.3,10.5}

It says I have 12 errors and I have tried so many things to fix it and I just don't know what to change to make it work.

View Replies View Related

GUI Program - Convert Input Name To Number

Mar 12, 2015

A GUI program that allows user to enter their name and the program will convert it in number using array.

For example if i input "EUNISE" the output should be 521149195

Because the letter equivalent of

a = 1
b = 2
c = 3
d = 4
e = 5
f = 6
g = 7
h = 8
i = 9
j = 10
k = 11
l = 12
m = 13
n= 14
o = 15
p = 16
q = 17
r= 18
s = 19
t = 20
u = 21
v = 22
w = 23
x = 24
y = 25
z = 26

View Replies View Related

Program To Convert Utf-8 To Cp1251 Format

Apr 11, 2014

I am trying to covert utf-8 encoding into CP1251 encoding. But i am getting null pointer exception.
 
package ProcessDefinition;
import java.util.*;
import java.io.*;
import java.lang.String;
public class Process

[Code] .....

View Replies View Related

Write A Program For Converting Positive Binary Inputs Into Hex

Sep 29, 2014

I am trying to write a program for converting positive binary inputs into hex.Why am i getting this errors while compiling my binary to hex converter..

Exception in thread "main" java.lang.NumberFormatException: For input string: "148.0"
at java.lang.NumberFormatException.forInputString(Num berFormatException.java:65)
at java.lang.Long.parseLong(Long.java:441)
at BinToHex.convertbintohex(BinToHex.java:24)
at Test.main(Test.java:4)

Here is my BinToHex class

import java.io.*;
public class BinToHex {
double tempDec,fractionpart;
long longofintpart,templongDec;
String inpu ="1001.01";
String hexOutput,intpart,tempDecString,hex = null;

[code]....

View Replies View Related

Writing A Program That Searches Array Using Binary Search

Jul 10, 2014

I'm (failing at) writing a program that searches an array using binary search, but I can't get it to work.

My code so far is this:

Java Code:

package sorting;

import java.lang.*;
import java.util.*;
public class sorteh {
public static void main(String [] args){
int[] array=new int [20]; //creates new array
for (int x=0;x<array.length;x++){ //populates array
array[x]=x*3+1;

[code]...

I copied what a website did for the sorting part, but if I have low=0 and high=19, wouldn't mid not be an int?

View Replies View Related

Program Keeps Prompting To Enter Correct Binary Number

Sep 10, 2014

I wrote a java program for my gui number converter app, the main purpose of this program is to make sure that user enters only a binary number for conversion from binary to other number formats. the problem is my program keeps prompting me to enter correct binary number, no matter if i enter correct binary number, it will still keep prompting me to enter correct number. Here is the code

import java.util.*;
public class test {
Scanner key = new Scanner(System.in);
String in;
int b;
public test()

[Code] .....

View Replies View Related

Program To Convert All Vowels To Capital Letter In A Sentence?

Jul 3, 2014

i am new to programming skills it may be silly question for experience but for me it's new thing. actually i tried a lot but i am facing problem when i trying to take input through Scanner. if i will take input a sentence directly as a string it's working . but when i am trying with Scanner the first word is showing next are not showing

public class Demo2
{
public static void main(String[] args)
{
String s1="hi how are you";
s1=s1.replace('a', 'A');
s1 =s1.replace('e', 'E');
s1 =s1.replace('i', 'I');

[Code]...

this is working properly.

but when i trying with Scanner i am facing problem.

public class Demo2
{
public static void main(String[] args)
{
java.util.Scanner scn= new java.util.Scanner(System.in)
String s1=scn.next();
s1=s1.replace('a', 'A');

[Code]...

View Replies View Related

Program Converting Fahrenheit To Celsius Using For Loop (will Not Convert)

Sep 13, 2014

I am trying to write a program converting Fahrenheit to Celsius using a for loop. I get it to run and Fahrenheit goes to a hundred. My issue is that the Celsius just says 100 down the column and is not converting. I have tried messing with it, and can not figure what is wrong with it.

import java.util.Scanner;
public class Controlstatement {
public static void main(String[] args) {
double F = 1.0;
double Celcius = 100;
System.out.printf("%s%20s", "Farenheit", "Celcius" );
for (int Farenheit = 0; Farenheit <= 100; Farenheit++) {
F = Celcius * (Farenheit - 32 * 5.0/9.0);
System.out.printf("%4d%,20.2f", Farenheit, Celcius);
}
}
}

The output looks like this all the way to 100:

Farenheit Celcius
0 100.00
1 100.00
2 100.00
3 100.00

View Replies View Related

Program For Converting Positive Binary Inputs Into Hex - Unexpected Output Java

Sep 30, 2014

I am trying to write a program for converting positive binary inputs into hex. in the hex output the point (".")is missing.

Suppose my expected output is e7.6 , but i am getting e76.

Only the "." is missing.

Here is my BinToHex class..

import java.io.*;
public class BinToHex {
double tempDec,fractionpart;
long longofintpart,templongDec;
String inpu ="11100111.011";
String hexOutput=null,tempDecString,hex = null;
 
[Code] .....

Here is how decimal fraction is converted into hex or here too...

View Replies View Related

Making A Program That Could Convert Metric Units Into American System

Aug 31, 2014

I just started programming yesterday, and I have been making little programs to learn some algorithms and the syntax of java. I tried making a program that could convert metric units into the American system. Whenever I try to compile the code, it shows up as an "incompatible type" error. I know this is probably a very obvious answer to most of you, but I can't figure it out.

import java.util.Scanner;
public class MetricToAmerican
{
public static void main(String[] args)
{
Scanner scan = new Scanner(System.in);
System.out.println("fWhat measurement would you like to convert into US system?
celsius, meter, or kilogram ");

[code]....

View Replies View Related

Write GUI Program To Convert All Lowercase Letters In String To Uppercase?

Mar 21, 2015

Write a GUI program to convert all lowercase letters in a string to uppercase letters, and vice versa. For example, Alb34eRt will be converted to aLB34ErT.

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved