What Numbers Can Be Used To Produce Determinant Of 1/2
Nov 29, 2014How to find a set of number that will do this? I need it to test a program I am writing.
View RepliesHow to find a set of number that will do this? I need it to test a program I am writing.
View RepliesI'm not sure why, but my program does not produce an output. It is supposed to output total charges.
/*This program provides the user with the price of their monthly internet service based on two inputs.The program asks users which subscription they have. The options are A, B, or C. This is the first input.
The program then will ask the user how many hours they used the internet for. This is the second input.Then, based on the package number, the program will compute their monthly bill. This is the output.
The program calculates the price based on the following prices:
Package A: For $9.95 per month, 10 hours of access are provided. Additional hours are $2.00 per hour.
Package B: For $13.95 per month, 20 hours of access are provided. Additional hours are $1.00 per hour.
Package C: For $19.95 per month, access is unlimited.*/
import java.util.Scanner;
public class Lab03SV
[code]...
I'm trying to produce a random number between 1 and 54 . I think this is correct
int i= (int)(Math.random()*54)+1;
Write a function (or functions) that given a collection of files will produce a sum of integers from each line of each file. Each file can have any number of lines from 1 to N. Each line can contain only one integer and no other alphanumeric characters. All of the numbers from all of the files should be added to the final result. The result is just one number.
View Replies View Related1.Write a program to produce a similar output for n characters, where n is a odd number. The below output is for n=7.
Java Code:
A B C D E F G F E D C B A
A B C D E F F E D C B A
A B C D E E D C B A
A B C D D C B A
A B C C B A
A B B A
A A
mh_sh_highlight_all('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:
- .... .
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] .....
I have a question: I have a Java/JSP/JavaScript project that access back end Oracle database, and provide interaction through tomcat. After we deployed our project, I found one button does not generate necessary warning message from server, but when I deployed and tested our project on local PC, it does generate correct warning message. I am using the same IE, same tomcat version, and I am sure my container is pointing to the same database, and I am sure I using same version of project code by checking with GIT.
Here is the button that I click:
<a target="frmMain" href="RealignServlet?button=REALIGNMENT" title="Procedure Alignment">Align</a><br>
And here is part of the code of RealignServlet:
public class RealignServlet extends SiapBaseServlet {
private static final long serialVersionUID = 1L;
private static final Logger logger = AppLogger.getLogger(RealignServlet.class.getName());
private static final String PROC_QUERY_JSP = "ProcQuery.jsp";
private static final String REALIGN = "REALIGNMENT";
[Code] .....
Our problem is server could not generate alignMsg. But we can get it on local deployed project.
So my goal is to use the graphics class to draw this shape: [URL] ....
so far I've managed to draw the bottom half, but now I want to utilize the copyArea() method to flip the bottom half and copy it to produce the upper half of the shape: [URL] ....
and this is what I wrote to produce the bottom half:
import java.awt.Graphics;
/*
* 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.
*/
public class MyFrame extends javax.swing.JFrame {
/**
* Creates new form MyFrame
*/
public MyFrame() {
initComponents();
[Code] .....
I am working on a personal project and want to create a text editor to write my code. I am wondering how could I read the last input from the user and if say it was an open curly brace {, then like netbean's my editor will supply the closing curly brace. My java experience is limited but I have tried to read key board input and a few other options that did not work.
View Replies View RelatedDesign a program that will read a file of sales records and produce a sales report. Each record in the file contains a customer's ID, name, a sales amount, and a validated GST code. The GST code is to be applied to the sales amount to determine the sales tax due for that sale, as shown below.
GST CodeGST Rate
0
1
20%
5%
10%
The report is to print a heading "SALES REPORT", and detail lines listing the customer's ID, name, sales amount, sales tax, and total amount due including sales tax.
Is assignment
sofar:pseudo code
SalesReport
Read customer file
Get TaxCode
Get GSTAmount SalesTax
Calculate SalesTax
[Code] ....
I tried to create file and write the output of my program in it in java when i use WriteLong then the file does not contain long value, how I create this file my program is to print prime numbers between 500000 to 10000000
public class primenumber {
public static void main(String[] args) {
long start = 5000000;
long end = 10000000;
System.out.println("List of prime numbers between " + start + " and " + end);
for (long i = start; i <= end; i++) {
if (isPrime(i)) {
System.out.println(i);
[Code] ....
I've just written a program that generates 100 numbers that range from 0 ~ 25 using arrays, the program calls another method that sorts the even numbers into a separate array and returns the array. I need it to display both arrays, however, when I run my program, the numbers of both arrays are mixed together, and I'm not sure how to separate them.
[ public class Array1
{
public static void main(String[] args)
{
int array [ ] = new int[100];
for (int i = 0; i < array.length; i++)
{
array[i] = (int) (Math.random() * 26);
[Code] .....
I'm trying to make a program that generates 20 random integers between 1 and 20 and then prints the list of random numbers to the screen. After that, I want to print a different list to screen with the same numbers from the first list only skipping any number that has been already printed to the screen. So two lists are printed to the screen. The first one has 20 random numbers. The second one has those same 20 numbers but only prints the numbers in the first list that aren't duplicated. So if m
y list of 20 random integers contains three 2s and two 14s, only one 14 and one 2 is printed to the second list. Currently, my code generates 20 numbers from 1 to 20 and stores those numbers in an array but I don't know how to print solve the second part of my problem. I don't know how to print the s different list only without duplicate numbers. As a result, my output is nothing because it doesn't print any number from the first list as oppose to skipping only duplicate one.
public void randomNum(){
System.out.println("Twenty random integers: ");
int max = 20; // max value for range
int min = 1; // min value for range
Random rand = new Random();
int[] all = new int[20];
[Code] ....
I have to make a program that prompts the user to enter 10 numbers and at the end it prints out the distinct numbers and then the other numbers that weren't repeated...
I have the part where it prints out the distinct numbers but I stuck on how to make it print out the other numbers that didn't repeat...
import javax.swing.JOptionPane;
public class DistinctNumbers {
public static void main(String[] args) {
String getInput;
int input;
int[] numbers = new int[10];
[Code] ....
Create an integer array with 10 numbers, initialize the array to make sure there are both positive and negative integers. Write a program to generate two arrays out of the original array, one array with all positive numbers and another one with all negative numbers. Print out the number of elements and the detailed elements in each array.
public class problem3 {
public static void main(String[]args){
int[] numbers = {1, 2, 3, 4, 5, -1, -2, -3, -4, -5};
for (int i = 0; i<numbers.length;){
if(i>0){
System.out.println(numbers);
}
else
System.out.println(numbers);
}
}
}
I tried out doing number (generated randomly) != (another number) but that does not work. If I for example want a number between 1 and 10, but I do not want the number 5, what can I do in order to make this happen?
View Replies View RelatedProgram is to list all prime numbers between two entered numbers.
import java.util.Scanner;
public class question6 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println("Enter lower int:");
int x = input.nextInt();
[Code] .....
I wrote a program to find the sum of first 10 numbers using the for loop... here is the piece of code
public class Sum {
public static void main(String[] args) {
int sum = 0;
for (int N=0; N<= 10; N++) {
sum = sum + N;
}
System.out.print("The sum of first 20 numbers is " + sum);
}
}
I tried to write the same program using the while loop but with no success. How can i write this using while loop?
I don't know what I did to screw this up, but I had this code working to increment each employee ID by one every time a new employee was added. I tried to move the whole employeeID and newEmployeeID elements out of the constructor because everyone keeps telling me how bad it is to have those in the constructor. However, now, every time I add an employee, their ID number turns out to be 0. I have two other aspects of this project that are due soon, and if I can't fix this part, I won't be able to move forward to the other parts (which I am also stuck on at this point). The codes that are being used are as follows:
import java.io.*;
import java.util.*;
import java.nio.file.*;
import java.text.NumberFormat;
public class Employee
{
// instance variables
private String firstName;
private String lastName;
private int employeeID;
static int newEmployeeID = 0;
[Code] ....
how to add two numbers using RMI..This very simple example is taken from Chapter 24 of "Java 2: The Complete Reference" by P.Naughton and H.Schildt.The example is overly simplified but it still illustrates the basic steps in creating an RMI distributed program.
This example provides step-by-step directions for building a client/server application by using RMI. The server receives a request from a client, processes it, and returns a result. In this example, the request specifies two numbers, the server adds these together and returns the sum.(Of course, this program is intended only to illustrate the basic RMI mechanism.)The next subsections provide main steps in writing an RMI program
Define an interface that declares remote methods.The first file AddServerIntf.java defines the remote interface: it includes one method that accepts two double arguemnts and returns their sum. All remote interfaces must extend the interface Remote, that defines no methods: its purpose is simply to indicate that an interface uses remote methods.All remote methods should throw a RemoteException
import java.rmi.*;
public interface AddServerIntf extends Remote {
double add(double d1, double d2) throws RemoteException;
}
Implement the remote interface and the server
The second source file AddServerImpl.java implements the remote interface:
import java.rmi.*;
import java.rmi.server.*;
public class AddServerImpl extends UnicastRemoteObject
implements AddServerIntf {
public AddServerImpl() throws RemoteException {
}
public double add(double d1, double d2) throws RemoteException {
return d1 + d2;
}
}
All remote objects must extend UnicastRemoteObject which provide the functionaly that is needed to make objects available from remote machines. The third source file AddServer.java contains the main program for the server machine. Its primary function is to update the RMI registry on that machine. This is done by using the rebind() method of the Naming class (it is in java.rmi API). That method associates a name with an object reference.
import java.net.*;
import java.rmi.*;
public class AddServer {
public static void main(String args[]) {
try {
AddServerImpl addServerImpl = new AddServerImpl();
[code]....
Develop a client (an application or an applet) that uses the remote interface..The fourth source file AddClient.java implements the client side of this distributed application. This program requires 3 command line arguments: the IP address or name of the remote server, and two numbers that are to be summed.
The application forms an URL string using the rmi protocol, the first command line argument and the name "AddServer" that is used by naming registry of the server. The the program calls the method lookup() of the Naming class to find a reference to a remote object. All remote method invocations can then be directed to this object.The client program illustrates the remote call by using the method add(d1,d2) that will be invoked on the remote server machine from the local client machine where the client runs.
import java.rmi.*;
public class AddClient {
public static void main(String args[]) {
try {
String addServerURL = "rmi://" + args[0] + "/AddServer";
AddServerIntf addServerIntf =
[code]...
If you do not have an Internet connection, you can run all programs of this example on your local machine (both server and client). In this case, you can run
java AddClient 127.0.0.1 567 999
to use the "loop back" address (127.0.0.1) for the local machine. This will allow you to test the entire RMI mechanism without actually having to install the server on a remote computer.
The first problem is that the numbers don't round in IntelliJ.
Example: ('s in Dutch)
Geef de vorige kilometerstand: 125
Geef de huidige kilometerstand: 900
Geef het aantal getankte liters: 50
Verbruik voor 775km: 6.451612903225806/100km
That 6.4516..... is the problem, how can I make it 6.45/100km?
how to sum up two numbers of fractions?
View Replies View Related/*
* Put your documentation header here.
*/
import java.util.Scanner;
public class Lab5{
/**
* Returns an integer whose value is a^3 (a cubed).
* @param any integer to be cubed
* @return a^3 (a cubed)
[code]...
The last part with int a-j...... Is there a better way of doing this, like possibly putting into a loop and showing output from maybe a single piece of information?
I was trying to get sum of numbers between two given integer and managed to do it.
public int sum(int a, int b) {
int sum=0;
while(a <= b) {
sum+=a;
a++;
}
return sum;
}
in here; when I enter the values i.e 2 and 5, it calculates 2+3+4+5 and gives me the result 14.
my question is, how could I exclude a and b in this calculation ( in this case exclude 2 and 5 and return 3+4 )
Bonus question ; how could I only calculate the odd (or even) numbers between those integers?
program that calculates and prints the sum of all numbers between two limits as the user types. Like if the user types 1 and 10 on the upper limit, it prints the following text: "1+2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = 55".
View Replies View Relatedhow to determine if an integer is even or odd by using a boolean method. I think I have the method right, but it's calling the method into the main that has got me stumped.
import java.util.Scanner;
public class Odd_Even {
public static void main(String[] args) {
//Scanner, variables
Scanner input = new Scanner(System.in);
int number;
[code]....