Converting Pseudo-code Into Java Language?
May 12, 2015
I am trying to use a for loop for getting hours for an employee for five days. how to convert my pesodocode into java language so that it will compile. This is what my pesodocode looks like:
begin getHours()
for(index=0; index <5; index++)
get hours **System.out.println()
**inputString = input.readLine()
**plumbersHours[index] = plumbersHours [index] = integer.parseint(inputString)
endfor
index = 0
while (index < 5)
totalHours + = plumbersHours[index]
index++
end while
return
View Replies
ADVERTISEMENT
Dec 1, 2014
This was shown in class the other day and I'm still not sure of how exactly it works, even after looking at it through a debugger.
public void sort(){
for (int i = 0; i < size; i++) {
Node temp1 = head;
Node temp2 = head;
Node temp3 = head;
while(temp2.next!=null){
temp3 = temp2.next;
[Code]...
Again, I didn't write this code I'm just trying to understand it. Why specifically do three different temp values need to be used instead of just one like in most sorts?
It is part of a larger program that can be found below.
import java.util.Random;
public class MyQueue implements IntegerQueue{
class Node{
Node next;
Integer data;
Node(Integer data){
this.data = data;
[Code]....
View Replies
View Related
Oct 26, 2014
Is there any way to add duplicate keywords (for all java keywords) maybe in a different language such that we can program java in a different language.
View Replies
View Related
Aug 25, 2014
There's a main menu choosing binary,octa,hexa,and decimal if i choose decimal it will display decimal menu and then i will input the numbers of binary and then it automatically display the converting process for octa hexa and decimal. and if i choose octa . It display the octa menu and i will input the numbers in octa and then it automatically display the converting process for binary hexa and decimal.. and so on.. but in binary if i input 2 it will display invalid .. the same as octa hexa and decimal... in my code the only problem is the converting process. our instructor said no one will use a converter for our project. we will code it manually ..so for a moment .. this is my code..
import java.util.*;
import java.lang.*;
public class mainmenu {
public static void main (String[]args) {
Scanner in = new Scanner(System.in);
char B, O, H, D, Q, L, N , Y;
char bin , pk, pick ;
[code]....
View Replies
View Related
Jan 24, 2014
I have an image that moves with arrow keys, and I want to make it appear to be moving. So, I made that image, and then another with the legs moved, to give the illusion of motion. I added it to an event
Java Code:
if (k == KeyEvent.VK_RIGHT) {
image1 = image6;
peterx = peterx + 10;
resetIt();
repaint();
} mh_sh_highlight_all('java');
But it only serves to change it once. How would I make it revert to the original frame once it is converted to the second frame (image 6)? I tried a gif but to no avail?
View Replies
View Related
Jun 6, 2014
import java.util.Scanner;
public class Exercise1{
public static void main(String[] args) {
String employeeName, employeeNumber, position, department ;
double otpay, salary, deduction, hrs, rate ;
Scanner input = new Scanner (System.in);
[Code] ....
That's my codes but its wrong according to our prof. it should be in frame form. i don't know how to do it since i did not encountered framing since i was started in java.
View Replies
View Related
Dec 22, 2014
I'm converting from ASP to Java for a legacy site. I believe the first part of the if statement is right but I'm having an issue within the else staetment. I'm getting date is undefined, I've tried using getYear and getDate but have not been successful.
ASP:
If Request("action") = "results" Then
aMonth = Request("selMonth")
aDate = cint(Request("selDate"))
aYear = cint(Request("selYear"))
Else
aMonth = UCase(MonthName(Month(Date()),true))
aDate = Day(DateAdd("d",-1,date()))
aYear = Year(Date())
End If
[code]....
View Replies
View Related
Jan 28, 2014
This is the code to convert string into unicode but I get an error as "illegal start of an expresssion"while running the code..
import java.util.Scanner;
import java.lang.String;
import java.lang.Character;
public class A
{
public static void main(String args[])
{
[Code]...
View Replies
View Related
Oct 5, 2014
I compiled a java program and converted it to an exe file and it works fine on the computer I created the java file in but when i try it on another computer it gives me a "Java Virtual Machine Launcher - A Java Exception has occured" error message.
View Replies
View Related
Jan 20, 2015
I'm trying to convert a Formula to run in a java program.
This is the formula:
(you can ignore the modifier part)
This is my attempt. However it prints out 0.0
import java.util.Scanner;
public class DamageCalc{
public static void main(String[] args){
Scanner s = new Scanner(System.in);
[Code].....
View Replies
View Related
May 13, 2015
I wanted equivalent datatype of longblob in java ...
View Replies
View Related
Mar 29, 2014
I want to use google translate api to translate language from one language to another...
View Replies
View Related
Mar 20, 2014
I am trying to Extract the ranges of Variables from a Text File. I extracted lines of the forms X in 1..10 Y in 12..50 Z in 0..19 / 66/ 95..100 Where X in 1 ..10 states that X takes values from set 1 to 10 Similarly for Y and for Z its a Union of different ranges of the values (0 to 19, union 66,union 95 to 100)
I want to Map these Variables to their respective sets using Hashmap where Key is Variable name and value will be a Set. My Hashmap Signature is HashMap> hm=new HashMap>();
Java Code:
while((line=br.readLine())!=null) {
Matt=Patt.matcher(line);
if(Matt.find()) {
//System.out.println(line);
String []s=line.split(" ");
[Code] .....
I am stuck at extracting the variables ranges from these plain strings.
View Replies
View Related
May 12, 2014
Which of these is not a real differentiator for programming languages:
a) Object-oriented / Process-Oriented
b) Interactive / Automated
c) Interpreted / Compiled
d) Strongly-Typed / Weakly-Typed
e) All of the above
f) B and C
g) B and D
Almost all support OOP, Interactive/Automated, Interpreted/Compiled but not sure about Strongly typed/Weakly typed.
View Replies
View Related
Apr 4, 2015
I have a class called "HelloController" and it extends SimpleFormController. I have the following method inside of HelloController.java:
protected Map referenceData(HttpServletRequest request) throws Exception {
Map<String,String> language = new dHashMap<String,String>();
language.put("Spanish", "Buenos Dias");
language.put("French", "Bonjour");
return language;
}
How would I create a JSP file that would accept a language as its input and return a greeting in that language? For example, if the user enters "Spanish", then the user should see "Buenos Dias." If the user enters "French", then the user should a see "Bonjour".
View Replies
View Related
May 21, 2014
In my Icefaces 3 application I have a ManagedBean ancestor that defines common attributes to those they spread it. Including CSS styles to be apply at the menu as icons depending on whether they are selected or not. Classes that extend the CommonMBean class define styles. My question is what do I have to put in the language experssion styleClass to tell him that the getter to use is that of the parent class.
CommonMBean.java
package com.omb.view;
public class CommonMBean
private String menu1Css = "";
private String menu2Css = "";
[code]....
View Replies
View Related
Mar 19, 2014
In the servlet class I have:
String name = "James Bond";
Session.setAttribute("name", name);
Why is the attribute name and attribute value the same in all the books I've read. I know one is a string literal and one is an object but must it be the same?
Second thing I'm confused about... let's say I change the servlet code to
String name = "James Bond";
Session.setAttribute("hisname", name);
When I try to access it using JSP:
${sessionScope.name}
it works fine. So what is the point of the first argument in Session.setAttribute() ?
View Replies
View Related
Mar 3, 2014
I am new at JSF and i want to do some things.
->When the user request for a file that is not exists i want to redirect to a valid url where i can inform him that the file does not exists.
->I am trying to use the properties messages for the language that the user has. I want to use it cause i want to reuse some of the message and it is easier to translate the page to other languages. How when the browser has a default page English to let user change the language to Italian for example but for all page.
View Replies
View Related
Jan 18, 2014
I want a java program to find the language of a given text in a program
For Example: If user enters Hello World it should say its english language
And if he enters a spanish language as a input it should say its spanish language and so on....
View Replies
View Related
Oct 31, 2014
how to use Java and for my coursework I have been asked to construct an application that will read in the exam mark and coursework mark and then print out to 1 decimal place the average of the coursework and exam mark. When I submit it to the coursework submission system it says it's incorrect.
The answer that it's asking for is the answer that my code produces (ex = 71 cw = 40 mark = 55.5) But for some reason it says this when I submit it:
-#### << Differences between expected (<) your answer (>) >> ------------
1c1
< ex= 91 cw = 80 mark = 85.5
---
> ex = 71 cw = 40 mark = 55.5
-------------------------------------------------------------------------
Check the above output for why this attempt failed And when I change the ex to 91 and cw to 80 it asks for > ex = 71 cw = 40 mark = 55.5 again.
class Main
{
public static void main( String args[] ) {
int ExamMark=71;
int CourseworkMark=40;
double cost = (double)(ExamMark + CourseworkMark) / 2;
System.out.printf("ex = " + ExamMark + " cw = " + CourseworkMark + " mark = " + cost);
System.out.println();
}
}
View Replies
View Related
Sep 14, 2014
I am trying to create a program that allows me to enter 5 students numeric grade (0-100) to a letter grade (A, B, C, D, F) and I CANNOT use an array. When I try to run my program it says main class not found, and when I change the it from a string to a void in the main method it does not work.
Java Code:
import java.util.Scanner;
public class Week3ControlStatements2
{
public static String main(String[] args){
int numberGrade = 0;
int quotient = numberGrade / 10;
int remainder = numberGrade % 10;
[Code] ....
View Replies
View Related
May 31, 2014
PHP Code:
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page import="Javabean.Articolo"%>
<%@page import="java.util.ArrayList"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
[Code] .....
I'm using Netbeans with glassfish server 4. When i try to launche the web page, i see that "nome" is not printed... Why? My older projects that uses EL, still works fine, while this wont' parse the syntax... why??
View Replies
View Related
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 input ="11100111.011";
String hexOutput=null,tempDecString,hex = null;
static int i = 1;
[Code] ....
View Replies
View Related
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
Jul 23, 2012
I learning java an created the following servlet. The only problem is it printed to the browser as text instead of html..
It literally printed like this.
<html>
<HEAD><TITLE>Hellow World</TITLE></HEAD>
<body>
This STUFF IS WORKING!!!!!!!!!!!!!!!!!!
</body></html>
Why???
This is the servlet I created.
package sample;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class HelloWorld extends HttpServlet {
[Code] ....
View Replies
View Related
Oct 30, 2014
Below is my code
<%--
Document : closeAc
--%>
<%@page import="javax.swing.JOptionPane"%>
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" import="java.sql.*, java.util.Date;"%>
<%
try {
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
[code]....
All I'm trying to do is to search the data from the database and is doesn't show up!
View Replies
View Related