La Trobe University OOF Assignment Part B - due: 10:00 am 30th of April 2019 this is the first and final hand in date p. 1 of 9 Department of Computer Science and Information Technology La Trobe...

1 answer below »
HiThis assignment doesn't have any word limit. The assignment has some conditions of not using any code and techniques out of the course explained till date. So please read the instructions carefully.


La Trobe University OOF Assignment Part B - due: 10:00 am 30th of April 2019 this is the first and final hand in date p. 1 of 9 Department of Computer Science and Information Technology La Trobe University CSE4OOF Semester 1, 2019 Assignment Part B This is an individual Assignment. You are not permitted to work as a Pair Programming partnership or any other group when writing this assignment. Due Date Due: Tuesday 30th of April 2019 at 10.00 a.m. Execution test: Week 8 Delays caused by computer downtime cannot be accepted as a valid reason for a late submission without penalty. Students must plan their work to allow for both scheduled and unscheduled downtime. There are no days late or extensions on this assignment as execution test marking will begin on in your normal lab - Week 8. After the submit server has closed, NO assignments can be accepted. Non- attendance at the Week 8 lab you have signed up for on the LMS page will also result in your assignment being awarded 0, except as detailed below. Copying, Plagiarism Plagiarism is the submission of somebody else’s work in a manner that gives the impression that the work is your own. The Department of Computer Science and Information Technology treats academic misconduct seriously. When it is detected, penalties are strictly imposed. Refer to the subject guide for further information and strategies you can use to avoid a charge of academic misconduct. Assessment Objectives  To practise using the String class. (Lecture/Workshop 2)  To practice using switch and/or multiway selection branches  To practise reading from and writing to the console and reading from a text file. (Lecture 4, Lab 3)  To practise using loops (repetition) Submission Details and marking Full instructions on how to submit electronic copies of your source code files from your latcs8 account are given on page 2. All assignments in CSE4OOF are marked, face to face, in the lab, in an execution test. This means that we mark running code. Your code must compile and display a result to the screen. Regrettably, we don't have the time or resources to look at code. The smallest amount of code that produces and displays a correct result will gain more marks than lots of code that doesn't compile, run or display something to the screen. If you cannot attend the lab you have signed up for on the LMS page, please email me ([email protected]) to arrange another time. Marking summary This assignment is worth 3% of your final mark in this subject. Implementation (Execution of code) 80%, explanation of code 20% Instant zeros or heavily reduced marks Not submitting code Using arrays Not attending marking session Not able to explain code that has not been taught yet Does not run on latcs8 Uses System.exit() ChemicalReactionBalance.java 100% (80% Execution and 20% Explanation) 8% OOF Assignment Part B - due: 10:00 am 30th of April 2019 this is the first and final hand in date p. 2 of 9 Using code not taught in OOF Please also note carefully that whilst we encourage innovation and exploring java beyond what has been presented in the subject to date, above all, we encourage understanding. All of the Tasks that follow can be solved using techniques that have been presented in lectures, lecture / workshops and labs so far. These are the techniques and knowledge that we will later be examining in the Real Time Test (20 marks) and the exam (50 marks). Code and techniques that are outside the material presented will not be examined, of course. For this task you cannot use arrays Other than this, you are free to solve the tasks below in any other way, with one exception and one condition. Any assignment that uses code that is outside what has been presented to this point must be fully explained at the marking execution test. Not being able to fully explain code outside what has been presented in the subject so far will result in the assignment being awarded a mark of 0, regardless of the correctness of the program. Submitting an assignment with code outside what has been presented so far and not attending the marking execution test will result in an automatic mark of 0, regardless of the correctness of the submission. An example would be the split( ) method in the String class. The reason being that this method returns an array and we haven't studied arrays yet. So using the split( ) method would require you to be prepared to explain to the marker how arrays worked in Java. Electronic Submission of the Source Code  Submit all the Java files that you have developed in the tasks above.  The code has to run under Unix on the latcs8 machine.  You submit your files from your latcs8 account. Make sure you are in the same directory as the files you are submitting. Submit each file separately using the submit command. submit MOF ChemicalReactionBalance.java After submitting the files, you can run the following command that lists the files submitted from your account: verify You can submit the same filename as many times as you like before the assignment deadline; the previously submitted copy will be replaced by the latest one. Please make sure that you have read page 1 about the submission close off date and time and the compulsory requirement to attend the execution test in Week 8 Failure to do both of these things will result in your assignment be awarded a mark of 0, regardless of the correctness of the program. Execution test marks are provisional and subject to final plagiarism checks and checks on the compliance of your code to this assignment document. As such, final assignment marks may be lower or withdrawn completely. OOF Assignment Part B - due: 10:00 am 30th of April 2019 this is the first and final hand in date p. 3 of 9 Background - Task You are tasked with writing one Java program related to chemical compounds and elements. In the task, given a set of compounds, two reactants and two products, and you will determine if the reactants and products are balanced. Background – Chemical Elements A chemical element is a type of atom that make up all the ordinary mater in the universe, and is define as an atom that has the same number of protons in its nucleus. Currently there are 118 known elements. These 118 can be represented on the periodic table of chemical elements as shown below: Background – Atomic Numbers and Element Symbols The elements are all given names but are often represented as a series of letters (element symbol), starting with an Upper-case letter and following with zero, one or two lower case letters. These can be seen on the periodic table as shown below. Periodic Table Source: LeVanHan Creative Commons Element Name Element Symbol Beryllium Source: LeVanHan Creative Commons OOF Assignment Part B - due: 10:00 am 30th of April 2019 this is the first and final hand in date p. 4 of 9 Background – “element_list.csv” A list of all known elements has been put into a file for you named “element_list.csv” and is guaranteed to be without errors and 118 lines long. (Note: The elements are not in Alphabetical order) You will not need this for this task, but is included for your interest. This file can be copied from the csilib area cp /home/student/csilib/cse4oofbu/assignBu19/assignB/element_list.txt . Background – Chemical compounds A chemical compound or molecule is collection of atoms of more than one chemical element held together by chemical bonds. A common example of this is pure water, which is made up of two Hydrogen atoms and one Oxygen atom that are chemically bound. Background – Chemical formula (molecular formula) A chemical formula lists the elements and the proportion of atoms per element using element symbols. More specifically the chemical formula written as a molecular formula includes the exact number of atoms per element using element symbols. This is done by listing the symbols and a subscript to indicate the number of atoms for a particular atom (with no subscript indicating one). Example: ?2? Looking at our periodic table we can see the symbol H stands for Hydrogen, and O for oxygen. The subscript 2, indicates that there are two Hydrogen atoms and one Oxygen atom. Background – Chemical Reaction A chemical reaction is a process where one or more compounds/elements known as the reactants are converted into one or more different compounds/elements known as the products. The reactants and products will have an equal amount of atoms of the same elements. Example When iron and sulphur combine they form iron sulphide This can be represented using the following form (chemical equation) ?? + ? → ??? The compounds on the left-hand side of the arrow are the reactants and the products on the right. A + on the left-hand side can be thought of as “plus”, where as a + on the right-hand side can be thought of as “and”. For our program we will accept two reactants and two products. Model of a Pure Water Molecule Public Domain OOF Assignment Part B - due: 10:00 am 30th of April 2019 this is the first and final hand in date p. 5 of 9 Background – Balanced Chemical Equation Given the following chemical equation ?3?8
Answered Same DayApr 22, 2021CSE4OOFLa Trobe University

Answer To: La Trobe University OOF Assignment Part B - due: 10:00 am 30th of April 2019 this is the first and...

Pritam answered on Apr 27 2021
166 Votes
import java.util.Scanner; // Import the Scanner class

public class ChemicalReactionBalance
{
    public static void main(String[] args)
    {
        Syste
m.out.println("\n*** 37777777 John Smith ***");    // please replace with your own details
        
        System.out.println("\nChemical Reaction Balance Check");
        
        // prompt for user input
        String product1, product2, reactant1, reactant2;
        Scanner s = new Scanner(System.in);                     // create a Scanner object
        System.out.print("Enter Reactant1: ");
        reactant1 = s.nextLine();                    
        System.out.print("Enter Reactant2: ");
        reactant2 = s.nextLine();
        System.out.print("Enter Product1: ");
        product1 = s.nextLine();
        System.out.print("Enter Product2: ");
        product2 = s.nextLine();
        
        // store the coefficients of each reactant and product
        char firstChar;
        int coeffR1 = 1;
        if( reactant1 != null && reactant1.length() > 0 )
        {
            firstChar = reactant1.charAt(0);
            if( Character.isDigit(firstChar) == true)
            {
                coeffR1 = Character.getNumericValue(firstChar);
                reactant1 = reactant1.substring(1);
            }
        }        
        int coeffR2 = 1;
        if( reactant2 != null && reactant2.length() > 0 )
        {
            firstChar = reactant2.charAt(0);
            if( Character.isDigit(firstChar) == true)
            {
                coeffR2 = Character.getNumericValue(firstChar);
                reactant2 = reactant2.substring(1);
            }
        }    
        int coeffP1 = 1;
        if( product1 != null && product1.length() > 0 )
        {
            firstChar = product1.charAt(0);
            if( Character.isDigit(firstChar) ==...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here