Question

How would I be able to input a chemical compound in order to get the molecular...

How would I be able to input a chemical compound in order to get the molecular mass of the compound while using the Stacks class to find the sum but not use the Scanner class?

Homework Answers

Answer #1

//Please comment it you have any queries

Answer:

Firstly, there are multiple ways to give input from the user in java. If you do not to use the Scanner class, then you can use BufferedReader class instead in Java.

To input chemical compound without Scanner class, you can use below code

Syntax:

import java.util.*;
import java.lang.*;
import java.io.*;
public class Stacks
{
   public static void main (String[] args) throws java.lang.Exception
   {
    BufferedReader chemicalCompound = new BufferedReader(new InputStreamReader(System.in));

  // Reading data using readLine

  String strChemicalCompound = chemicalCompound.readLine();
}
  

}

// Note: To read other types, we use functions like Integer.parseInt(), Double.parseDouble(). EX

int size = Integer.parseInt(chemicalCompound.readLine());
Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
ex3 Write a method public static boolean isPalindrome(String input) that uses one or more stacks to...
ex3 Write a method public static boolean isPalindrome(String input) that uses one or more stacks to determine if a given string is a palindrome. [A palindrome is a string that reads the same forwards and backwards, for example ‘racecar’, ‘civic’]. Make sure that your method works correctly for special cases, if any. What is the big-O complexity of your method in terms of the list size n. Supplementary Exercise for Programming (Coding) [Stacks] Download and unpack (unzip) the file Stacks.rar....
In matlab how to make it that i can be able to type in the file...
In matlab how to make it that i can be able to type in the file that I would like to test and to be able to test what algorithm i have. This is what i have so far. But I need help fixing the rest. Please help I need this asap. function FunctionAlgorithm() disp("Welcome to ___________ algorithm") filename = file = input('Type in the file to test: '); number = input('Type the number of the algorithm you want to...
how can I find potential molecular formula from molecular ion given m/z (mass/charge)? ex: given m/z...
how can I find potential molecular formula from molecular ion given m/z (mass/charge)? ex: given m/z 148... solutions manual says potential molecular formula could be C10H12O
Unsure as to how I would be able to have an array behave as a stack...
Unsure as to how I would be able to have an array behave as a stack in java by removing the last (top) element of an array as well as pushing a new element into the top to the top of the stack. All without using any packages.
how do I know if a chemical species would be atracted to a magnetic field ?...
how do I know if a chemical species would be atracted to a magnetic field ? and how do I determine this?
Hello can someone show me how to incorporate my method integerPower into the main? I want...
Hello can someone show me how to incorporate my method integerPower into the main? I want it to be able to take in the values the user inputs and calculate the value. here is the code I have so far: { public static void main(String[] args) { Scanner input = new Scanner(System.in); int base; int exponent; System.out.printf("Enter base value: ");    base = input.nextInt();    System.out.printf("Enter the exponent value:");    exponent = input.nextInt(); } public static int integerPower(int base, int...
How do I use the computer to input an expression with fractions to find a solultion?
How do I use the computer to input an expression with fractions to find a solultion?
how would i do a from-to chart to find out whats the best way to get...
how would i do a from-to chart to find out whats the best way to get from the front of the building to the back. the building has 7 rooms
Suppose your body was able to use chemical energy in gasoline. How far could you pedal...
Suppose your body was able to use chemical energy in gasoline. How far could you pedal a bike at 15 km/hr on energy of 1 gal of gas? I'm having trouble finding the answer to this question but I am also having trouble with the assess questions listed below. If you could please help me solve those as well, that would be great. Thank you! Assess C1: Discuss the result by comparing distance you'll be able to cycle with energy...
Can i get the answer to these questions in detail explaining how you go to the...
Can i get the answer to these questions in detail explaining how you go to the solution 1.Convert to/from Hex (0) 2.Octal Binary Unsigned/ 2’s complement 3.Understand how to shift and rotate. 4.Understand the relationship between shifting and multiplication/division 5.Be able to recognize and use the following gates: AND OR NOT NAND NOR XOR 6.Understand how a half adder works Given a logical statement ((A OR B) AND NOT(C OR A)) show the gates. 7.What is the difference between an...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT