Write A Program That Takes Two Numbers And Multiplies Them

Jul 8, 2014

I am trying to write a program that takes two numbers and multiplies them. I got this idea from this running conversion program

import java.util.Scanner;
public class Convert
{
public static void main (String [] args)
{
Scanner reader = new Scanner (System.in);
double farenheit;
double celsius;

[code]...

i am getting a cant find symbol for the output = (alpha*beta) line..Also, am I using the reader object correctly ? hould I create two reader objects as there are 2 inputs needed?

View Replies


ADVERTISEMENT

Program That Takes User Odd Number And Print Prime Numbers Lower Than User Input

Nov 4, 2014

I have been struggling with this program for weeks. This program is supposed to take a user's inputted odd number and then print out all prime numbers lower than that number.

public class PrimeNumber
{
Scanner scan = new Scanner(System.in);
int userNum;
String neg;

public void getUserNum()

[code]...

View Replies View Related

Write A Program That Find The Sum Of Two Numbers 62 And 99?

Jan 23, 2015

I have to write a program that find the sum of two numbers 62 and 99 and stores them in a variable named total. However, I have one error that I just can't get rid of and can't tell what it is. I'm using jGrasp and here's what it says:

Programming Challenge #5.java:14: error: class SumofTwoNumbs is public, should be declared in a file named SumofTwoNumbs.java
public class SumofTwoNumbs {
^
1 error
  ----jGRASP wedge2: exit code for process is 1.
----jGRASP: operation complete.

and here: is my code:

import java.util.Scanner; 
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
 /**
// This program has variable of several of the integer types.
public class SumofTwoNumbs {
public static void main(String[] args) {

[code]....

View Replies View Related

Write A Program That Prompts User For 3 Double Numbers

Feb 15, 2015

So i need to write a program that prompts the user for 3 double numbers x, y, z that outputs 2x^3 + 3y^5 + 3x^3y^2 +xyz with

(1) 4 digits precision
(2) with a ',' to separate thousands
(3) all digits of the result including the precision are put to 20 positions (from right to left)

I am not really sure what it is suppose to look like or how to start it.how to mix Math.pow with multivariable and printf.

View Replies View Related

Write A Method Called AddToOverThirty Which Takes Array Nums3 As A Parameter

Apr 22, 2014

i have to "Write a method called addToOverThirty which takes the array nums3 as a parameter. It adds 1 to all numbers that have a value greater than 30 in the array.

Add a call to the addToOverThirty method, then display a message telling what the output is followed by the results For example:The nums3 array after adding 1 to all numbers greater than 30 is10 6 15 and so on (check with the values you assigned to nums3)"its pointless because we were told not to make the array have a number over 30.

import java.lang.*;
import java.util.*;
public class LastProject
public static void main(String[] args) {
int nums1[] = new int[15];
int nums2[] = new int[15];
int nums3[] = {5,2,15,8,26,22,1,29,4,23,30,11,19,6,24};

[code]....

View Replies View Related

Make Simple Program Which Takes In Argument?

May 12, 2015

So I'm trying to make a simple program which takes in an argument (target) and then looks through an ArrayList of strings. If it finds a string that begins with (target) then it will return the index of that string. If it doesn't find a string which begins with (target) then it will return -1 instead.

For some reason, the program is always returning -1, rather than the index of the string within the ArrayList when there is one which matches the search criteria.

Here is the code:

public int getIndex(ArrayList<String> text, String target)
{
int i = 0;
int index = -1;
boolean found = false;

[Code].....

View Replies View Related

Program Takes A Photo And Convert To Grayscale Then To Sepia (can't Compile)

Feb 28, 2014

[ATTACH=CONFIG]27j.jpg49[/ATTACH]Hello,

I'm having the hardest time getting a program to compile. I'm beginning to think I've downloaded the incorrect version of turtle graphics. This symbol looks foreign and I'm unsure how to find a solution. I have fixed some of the errors since this last picture but I will write out my code. The program takes a photo and converts to gray scale then to sepia

import images.APImages;
import images.Pixel;
import java.util.Scanner;
public class sepia{
public static void main(String [] args){

[Code] ....

View Replies View Related

Program That Takes A User Inputted Number And Converts It To A Binary Number

May 5, 2014

trying to write a program that takes a user inputted number and converts it to a binary number.

Here's what I have:

package com.java2novice.algos;
import java.util.Scanner;
public class Converter {
static Scanner console = new Scanner(System.in);
public void printBinaryFormat(int number){
int binary = console.nextInt();

[Code]...

Bugs on:

Line 13
Line 17
Line 23

View Replies View Related

Program That Takes In Family Members Calculate Family Average Age And Prints Out AI

Mar 9, 2014

I am to design a program in java that will allow a user to Input a list of your family members along with their age and state where they reside. Determine and print the average age of your family and print the names of anyone who live in Texas. I have tried but my results are wrong.

View Replies View Related

Write Numbers From 1 To 1000 But 5 By 5

Oct 10, 2014

I need to write a JAVA program and algorithm that writes the numbers from 1 to 1000. Then I ned to write another one that writes the numbers from 1 to 1000, but 5 by 5. ( example 5,10,15,20,25,30)....

View Replies View Related

How To Write First 30 Fibonacci Numbers

Jun 29, 2014

I want to write the first 30 Fibonacci numbers so wrote this script:

Java Code:

int num1 = 1;
int num2 = 1;
int num3;
String x = num1 + ", " + num2;
for (int i=1; i==28; i++){
num3 = num1 + num2;
x += ", " + num3;
num1 = num2;
num2 = num3;
}
System.out.println(x); mh_sh_highlight_all('java');

This script outputs this only: 1, 1

View Replies View Related

Write Application That Display Numbers 1 To 4 On Same Line

Jul 22, 2007

I'm going to be taking an object oriented paradigm using java during intersession in a few months. I'm trying to brush up on it a bit. The problem is. Write an application that displays the numbers 1 to 4 on the same line, with each pair of adjacent numbers separated by one space. Write the program using the following techniques:Use one system.out.printLn statement.Use four system.out.print statement.Use one system.out.printf statement.

This is what i have so far .

Java Code: public class Display
{
public static void main(String [] args) {
System.out.print("1 ");
System.out.print("2 ");
System.out.print("3 ");
System.out.print("4 ");
System.out.println(" ");<----is that what that is supposed to look like, and where it goes?
System.out.printf(" %s %s %s %s ");????
}
} mh_sh_highlight_all('java');

i cant test this my console isn't working right, and i haven't finished my compiler install.

View Replies View Related

How To Write A Program Using TextEdit

Jul 21, 2014

How do i write a program using textEdit? I can't even get the examples to open?

View Replies View Related

Getting Program To Write To Output File?

Mar 19, 2014

My program successfully reads a file, reports back what it finds and creates an output file. However, I cannot get it to write to the output file, it is always blank!

Here's my code:

import java.util.Scanner;
import java.io.*;
public class Ex19
{
public static void main (String [] args)
{
//Variables

[code]....

View Replies View Related

Write A Program Called GeometricMean

Nov 24, 2014

Write a program called GeometricMean that prompts the user to

1.Enter the number of values (total number of instances) that should be processed

2.A set of values to be processed (in a while loop)and then calculate the geometric mean of the values entered. You should use a while loop to perform the multiplication part of the calculating the geometric mean. The program should output the initial data and the labeled geometric mean. Consider printf, and DecimalFormat.

My Program:

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

[code]...

View Replies View Related

Write A Java Program That Uses A While Loop

Apr 9, 2014

Write a java program that uses a While loop and persistent output to count down from 33 to 0 by threes, and put each value on a separate line, also do this in for loop.

View Replies View Related

How To Write Program Without Using Control Structures

Feb 24, 2015

How to Write Program with out using control structures

IMG_4216.JPG

View Replies View Related

Write A Program That Searches Through Files?

Dec 10, 2014

I'm trying to use graphics for my programs and here I'm trying to write a program that searches through files for text received from a JTextField. However, it does not seem to be working as my message is not displayed when text is found...

I used applet. Here are the functions:
 
JTextField jtf;
JFrame jf;
public void init()

[Code].....

View Replies View Related

GUI Program - Read And Write To File

Oct 17, 2014

I'm rather new to programming and I'm trying to make a gui program that will allow the user to create text files. They will be prompted to enter what they'd like to save their file as and then they will be allowed to input text to that file . They will also be allowed to open their files to modify or view its contents. So to start things off, I'm making a prototype if you will.. I've been able to save to a file the problem occurs when I try to read/display it.

Main Class:

public class MainActivity {
public static void main(String[] args) {
// Access to other classes
WriteFile writer = new WriteFile();
ReadFile reader = new ReadFile();

[Code] ....

View Replies View Related

How To Write A Program Which Compensate Average

Jan 12, 2015

I have a question. How to write a progamme which compensates an average if it is less than a 10/20. I use eclipse and database HSQLDB. I have a table with notes. After the compensates, I must change the note in my database.

I have three notes

12, 11, 5

The average is 12+11+5/3=9,33

I take the lowest note: 5

12+11+x/3 = 10

12+11+x/3 = 30/3

x=30-23

x=7

The new average is 12+11+7/3=10

View Replies View Related

Write A Program To Print Fibonacci Series Up To 100

Dec 31, 2014

My code:

public class Fibonacci {
/**
* @param args
*/
public static void main(String[] args) {
int f[]=new int[100];
for(int j=0; j<100;j++){
f[j]=j;

[Code] ....

How can I improve my code?

View Replies View Related

Write A Program To Create Dynamic Maps

Apr 15, 2014

As per requirement i need a dynamic multi map in my application. How to write a method to create the dynamically map.

View Replies View Related

How To Write A Program Using Quadratic Formula In JGrasp

Mar 4, 2015

Write a program named QuadraticTable.java that takes three double arguments and two int arguments (in that order) from the command line. The three doubles will represent a, b, and c from the quadratic formula.

If the discriminant is non-negative, find and print the solutions to the quadratic equation. (The plus/minus sign in the quadratic formula indicates that you would separately perform both operations). Otherwise print "no real solutions".

Then using the last two int arguments as x_min and x_max, print a table of x and ax

2 + bx + c

values using the a, b, and c read in as command line arguments.

Sample output: (command line arguments were 1 0 2 -3 3)

1x^2 + 0x + 2 has no real solutions.

X 1x^2 + 0x + 2

-3 11

-2 6

-1 2

0 2

1 3

2 6

3 11

View Replies View Related

Write A Program Using Loop And Break To Calculate Value Of Pi

Oct 5, 2014

having some trouble doing this. Here are the requirements:

1)Write a program using loop and break to calculate the value of PI.
2)You can use the following equation to calculate PI. PI=4/1-4/3+4/5-4/7+4/9-4/11+4/13 etc.. The program shouldn't loop until the criteria is satisfied.
3)The criteria is the value of PI you get is very close to the “real” value (3.1415926), meaning that their difference
should be smaller than a very small numeric number, e.g., 0.0001).
4)The control structures you may need for this program are loop, if-else, and unlabeled break.
5)The output should have the format: for each iteration, it has iteration number and the corresponding value of PI until that
iteration. The last line would be the final value of PI.

Here is my code so far:

package ids;
public class IDS {
public static void main(String[] args) {
double pi = 0;
for(int i=1; i<=100000; i++){
if ((i%2)==0){
pi+=(4/(2*i-1));

[code]...

View Replies View Related

Write A Java Program To Input 7 Integers?

Feb 21, 2015

Design, write a java program to input 7 integers and, for each integer, calculate and display its square and cube.

View Replies View Related

How To Write A Program To Record Names And Dates

Mar 2, 2014

I want an app that I can use to save the name, address, item sold, subject discussed and date that I visited someone - in a job similar to a sales rep. I would like to be able to choose how to sort the info so that if I sort by date I can see who hasn't been visited for the longest and start there. If I think of someone's name then of course I want to sort by name.

One of my friends says he works with "php"[? I'm still learning these terms] and everything happens online. I would like it to be an android app so it can be done without an internet connection ....

View Replies View Related







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