I'm currently working on a program that is supposed to translate morse code and then display the result and I'm stuck, my program has tons of errors when I try to compile.
public class Assignment10
{
public static void main ( String [] args )
{
String str = Input.getString("Please type in a word");
char [] letters = {'a','b','c','d','e','f','g',
Write a program that will read two numbers and an integer code from the keyboard. The value of the integer code should 1, 2, 3, 4. If the value of the code is 1, compute the sum of the two numbers. If the code is 2, compute the difference (first number minus second). If the code is 3, compute the product of the two numbers. If the code is 4, and the second number is zero, compute the quotient (first divided by second). If the code is not equal to 1,2,3,4, display an error message. The program is then to display two numbers, the integer code and the computed result to the screen
here is the code that I have so far:
public static void main(String[] args) { Scanner read = new Scanner (System.in); int num1, num2, code, sum; System.out.println("Please enter a number"); num1 = read.nextInt();
I'm making a program that can read an input of English or Morse code and return an output of Morse code or English back. The English-->Morse works fine, but not Morse-->English. I'm pretty sure my solution lies in displaying the variable 'morseWord', but no matter where I put it, I always get an error saying the variable has not been initialized. Here's what it looks like now:
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.
I have some software I need to write. I am planning to write two apps for Android, one of which will send and receive Morse code, and the other to send and receive PSK31 data.
Programming is not my strong point, and I am currently struggling on how to do this. I have researched the software, and I am having a hard time finding out how to decode the audio streams on Android. I have also had difficulty finding examples and source code as what I have found is mostly written in C/C++, whereas I need examples in Java.
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:
I have html code that use form and the result displayed with display tag library the form forward to servlet page but when I use a javascript to change value of hidden after returning to html page the value of hidden input deos not change
I have to do feet to meters code. here is the question. Write a Java program that reads a number in feet, converts the number to meters and displays the result. One foot is 0.305 meters.
here is my code :
import java.io.*; class FeetToMeters { public static void main (String[] args) throws IOException { InputStreamReader inStream = new InputStreamReader (System.in); BufferedReader stdin = new BufferedReader (inStream);
[Code] ....
I have seen alot of people use the scanner tool for the start of it but we never learned it as it is an online course but we may end up learning it farther on in our java programming. we have just started with the input and output stuff.
I am trying display the result set from the database.I am getting the following exception :
Caused by: javax.servlet.jsp.JspTagException: Don't know how to iterate over supplied "items" in <forEach> at org.apache.taglibs.standard.tag.common.core.ForEachSupport.toForEachIterator(ForEachSupport.java:286)
My Jsp code :
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
When I am invoking a servlet class file from my HTML file instead of displaying output in my browser it is downloading my output as a file..Why it is?..
I am having problems with writing a simple program to see if a number is divisible by 6.
public void run() { println("This program will display all numbers divisible by"); println(" 6 between 1 and 100."); int x =1; boolean divide =(x%6==0);
[Code] ....
It is telling that every number is not divisable by 6?
I need to create a simply application that would display the results of two dice thrown five times and the total of those results. This is shown below in the attached file.
The problem is, I have a do-while loop that loops 6 times. Inside the loop, I have 2 random.nextInt(5) that generate random numbers. But how can I output the total? How can I make a variable equal to the sum of the two random numbers if the two random numbers are located inside a do-while loop?
Attached below is also the code I have thus far.
(Attached below is both files: what it needs to look like, and what it currently looks like)
My mad lib program was able to store my three notepad text: noun, verb, and story. I would like to find out what is the best way to make it display my result randomize my story from notepad? once everything is stored?
import java.awt.*; import java.awt.event.*; import java.io.*; import javax.swing.*; import java.util.*; public class StoryProject extends JFrame implements ActionListener
I am trying to write a java code for a homework problem in my intro java class but im having problems. This is the problem:
Write a program that open the MyFile.txt and read from a file with these criteria.
1)-The program should display the first five lines of the file’s contents only.
2)-If the file contains less than five lines, it should display the file’s entire content. You must check for end of file and less than 6 lines on the loop iterations.
3)- your program should use loop to read the line by line of the file MyFile.txt.
The serperate myfile.txt has this
I can still remember, at the end of that year, we sat for the last time in our circle together. She played us her favorite song, "like a bridge over troubled water" and quietly passed out a gift she had made for each of us.She had made each of us a pottery heart with our name and the date on it on the back each read "I believe in ME".We all cried including her. She told us she would always remember US. We believed she would.
and this is what the code is suppose to look like after you run it : Java33.png
And this is what i have so far : Java22.png
what needs to go next to complete the javascript to show the first 5 lines of the text files?
I written java code in JSP to display data. I know it is bad practice. Actually my Business-service communicates with DB and returning data in the form of MAP. I don't have beans Because the fields in DB is dynamically changing. So, for now I'm retrieving Data by writing Java code in JSP. Is there any other way to display data without writing java code in JSP?
import java.util.Scanner; public class Magic { public static void main ( String args[] ) { Scanner in = new Scanner (System.in); int[][] square = new int [4][4]; int sqlength = square.length; int magicValue = sqlength * (sqlength * sqlength + 1) / 2;
[Code] ....
Here is what the output should look like.
Please enter the 4 values for row 0, separated by spaces: 1 2 3 4 Please enter the 4 values for row 1, separated by spaces: 5 6 7 8 Please enter the 4 values for row 2, separated by spaces: 9 10 11 12 Please enter the 4 values for row 3, separated by spaces: 13 14 15 16
in my ui i will i will select enabled or disabled then it will go in controller , i already debug it and it goes on the right controller based on what i select on ui my problem is when i select disabled it dont display the message but when i select enabled it displays the message, then i check the databases status is change based on what i select but when i change into disabled doesnt display any message.if select enabled will go in controller then change status into true then update the status then will see the message in ui
The purpose of this program is to translate a user inputed sentence into morseCode. It seems like everything is right to me, but I'm simply not getting output! What am I doing wrong, or what should I add/change?
Here is the main class:
public class MorseCode { public static String myInput; public static String[] myMorse; public static String myUserInput; public static char[] myAlph = {'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'}; public MorseCode()
How i would convert this java code to display using the printf statement, with two decimal places to the right...here is the source code so far, but it has a few errors and needs to be reformated for printf
import java.util.Scanner; // scanner class public class PROB3_CHAL15 { public static void main(String[] args) { double checks =0, totalfee =0, fee = 10, fee1 =.1, fee2 = .08, fee3 = .06, fee4 = .04, checkFee; String input; Scanner keyboard = new Scanner(System.in);
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)
I have been creating a Java program to track inventory using an array. I need to add a search function to it to take a term, input through a text field, and locate a matching instance within the array. How can I code a JButton to grab test input from a JTextField and search for it within the array then display the corresponding information? I also need to add buttons to add and delete items as well.