Task:
Project Overview
In the parallel universe of Bydysawd, matter exists in only 26 chemical elements. This is very convenient for Bydysawd scientists: the elements can be represented symbolically by the upper-case letters of the alphabet, i.e. A, B, C, ..., Z. These elements combine in a wide variety of different combinations to make up the various substances in Bydysawd.
Other than this, chemical reactions occur in similar ways to our universe, except that they routinely involve very large numbers of atoms. Bydysawd scientists use the following terminology in describing these reactions.
A term is a single element, possibly with multiple atoms, e.g. A3, B2579, Z. Where there is no number attached, it represents one atom of that element.
A formula is a sequence of terms denoting the atoms in one molecule, e.g. A3B, A89NX23, T2MT39M2T5M, Y5, Q. The last two are examples where all atoms in a molecule are the same element.
An equation is a rule describing a rearrangement of molecules in a chemical reaction, e.g.
A + B = AB
Y3 + Z2 = YZ + Y2Z
S99 = S33 + S33 + S33
Valid equations have equal numbers of all elements on both sides. Matter in Bydysawd cannot be created, destroyed, or transmogrified.
Two formulas represent isomers if they contain equal numbers of all elements, e.g.
ABA and A2B
LEVELLER and L2VE3RL
C12D4E and DC3EC3DC3DC3D
Bydysawd scientists need you to write a Java program to allow them to parse chemical equations and check their validity. Can you help?
If you have any questions about any aspect of the problem description, submit them to
. You do not need to know anything about chemistry to complete this project.
Project Materials
Download the folder Project1.zip from the LMS Project 1 page. This folder contains the following.
Skeletons for three Java classes.
Term
represents one term in a chemical formula.
Formula
represents one chemical formula.
Equation
represents one chemical equation.
Collectively, these classes describe Bydysawd chemistry. You are required to complete the constructors and methods for all three classes. Where the body of a constructor or method contains a comment
TODO
, delete the body and replace it with code which implements the required functionality, as described in the associated program comment. The numbers in these comments suggest an order for you to perform these tasks. (Don't worry, many of these methods are very simple!)
Three JUnit test classes, which are provided for you to check your code. Note that the test cases are not complete; a class that gets all green ticks is not guaranteed to be completely correct. Additional test cases will be used for marking and it is your responsibility to thoroughly test your code.
Feel free to use any methods from the Java libraries in your code. The following methods may be particularly useful.
In
String
:
length
,
charAt
,
substring
,
indexOf
,
lastIndexOf
,
strip
,
equals
,
compareTo
,
replaceAll
,
replaceFirst
.
In
Character
:
isDigit
and
isUpperCase
.
In
Integer
:
parseInt
.
In
ArrayList
: many methods will be useful.
Project Management Tips
Before starting the project
, students are expected to have
studied the lectures and Chapters 1-4 of the text,
completed the assigned labs during Weeks 2-5,
read and understood the whole of this project description,
read and understood all relevant UWA policies.
Submit any questions about any of this to
.
It is recommended that you tackle the project tasks in the order indicated; that you compile frequently; and that you test and run the code after completing each method, to ensure your code behaves as you think it ought, and does not fail any tests. If you are stuck on a method, it is often a good idea to look in the lecture material or in the text for an example method which is similar in some way to the one that is confusing you.
You can gain good marks even if you do not complete all the methods, so long as the code you have written compiles and runs correctly. But if you submit a large body of code that does not compile or that crashes often, then few marks can be awarded.
Hints and tips about the various methods may be uploaded here from time to time. Whenever that happens, the document version number at the top of the page will be updated.
Check out the library methods listed above; they will be crucial to completing the project successfully.
In particular,
String
processing is introduced on Slides 19-27 of the Week 6 lecture notes.
Neither of the
Term
constructors needs any parameter-checking.
None
of the methods in the project needs nested loops (except maybe the extension) - we haven't got that far yet in the unit. (If some people choose to use nested loops, remember there may be a simpler approach.)
For
lastUC
, you need to loop through the argument and return the highest index at which there is an upper-case letter.
For the
Formula
constructor, you need to decide where in the argument each term starts, turn each sub-string into a
Term
object, and add that object to the field. Make sure you add them in the right place - look in the library for the appropriate version of
add
.
For
standardise
, you need to decide how many atoms of each element the field has. There is a simpler way than using sorting...
isIsomer
is much simpler than it may appear, if you make good use of the methods you have already written
This IT Assignment has been solved by our IT experts at UniLearnO. Our Assignment Writing Experts are efficient to provide a fresh solution to this question. We are serving more than 10000+ Students in Australia, UK & US by helping them to score HD in their academics. Our Experts are well trained to follow all marking rubrics & referencing style.
Be it a used or new solution, the quality of the work submitted by our assignment experts remains unhampered. You may continue to expect the same or even better quality with the used and new assignment solution files respectively. There’s one thing to be noticed that you could choose one between the two and acquire an HD either way. You could choose a new assignment solution file to get yourself an exclusive, plagiarism (with free Turnitin file), expert quality assignment or order an old solution file that was considered worthy of the highest distinction.
Eureka! You've stumped our genius minds (for now)! This exciting new question has our experts buzzing with curiosity. We can't wait to craft a fresh solution just for you!