Sep 19
Sep 19
Sep 19
Sep 19
Jul 10

Computational Math Project

Information Comments Off on Computational Math Project

The heat conduction equation in a rod

For our final project, we were given a topic to look for a change of temperature on a stick within the stipulated time. For example, if a 100cm stick has a temperature of 100 ° C it will be cooled for 10 seconds. The purpose of this project is to find the temperature change every thousandth of a second for 10 seconds. So first, we will use numpy and matplotlib to calculate and search for results from this research. This can be done by:

import numpy as np;
import matplotlib.pyplot as plt
Import the following numpy and matplotlib to function the code for showing the graph and the calculation for numpy.

Next, we created a function to calculate the temperature at every thousandth of a second, as follows:

def calculate (pointinmid, calcmatrix, time, coeff, currtime = 1):

for cal in range (1, pointinmid-1):
calcmatrix [currtime] [cal] = calcmatrix [currtime-1] [cal] + coeff * (calcmatrix [currtime-1] [cal-1] +
calcmatrix [currtime-1] [cal + 1] – (2 * calcmatrix [currtime-1] [cal]))
print (calcmatrix [currtime] [cal])
print (“———————————————-” )
currtime + = 1
if (currtime <= time):
return calculate (pointinmid, calcmatrix, time, coeff, currtime)
else:
return calcmatrix
By putting pointinmid, calcmatrix, time, coeff, currtime = 1, as parameters in function, we will implement the formula

Tl + 1i = Tli + λTli + 1-2Tli + Tli-1
Where
λ = kt / (x) 2.
Next we create a ‘user input interaction’ where the user can determine the conditions that will determine the results of this research, as follows:

coeff = float (input (“Thermal conductivity:”))
x = float (input (“Length of the rod:”))
fronttemp = float (input (“Front temperature:”))
backtemp = float (input (“Back Temperature:”))
time = int (input (“Time:”))
pointinmid = int (input (“Total of Points between front and back:”))
The above input will determine the factors in the temperature difference in a stick. When running code, after we type the following input, intmid point will increase, deltax value x divide pointintmid. For coordx, we use the array to calculate the delta times of the rod by using a loop of (pointinmid + 1). Fronttemp is the starting point in a stick and also the initial temperature on a stick. Backtemp is the end point in a stick and also the last temperature on a stick.

Code of the final result:

pointinmid + = 1
deltax = x / pointinmid
coordx = np.array ([deltax * cordx for cordx in range (pointinmid + 1)])
pointinmid + = 1
initial = np.array ([[0.0 for i in range (pointinmid)] for j in range (time + 1)])
for l in range (time + 1):
initial [l] [0] = fronttemp
initial [l] [- 1] = backtemp
xtest = calculate (pointinmid, initial, time, coeff)
Example input:

 

Coeff = 0.1
X = 100cm
Fronttemp = 100 ° C
Backtemp = 50 ° C
Time = 10
Point in mid = 4

Final:

plt.figure (1); plt.clf ()
pl = plt.subplot ()
for h in range (time + 1):
pl.plot (coordx, xtest [h], “- o”)
pl.set_xlabel (“rod”)
pl.set_ylabel (“Temperature”)
plt.show ()

 

 

 

 

 

P.S. the program result can only be seen by my partner Nicander or Felix

Members:

Alfi  – 2101693574
Felix – 2101693851
Nicander 2101693113

Jul 10

Programming Languages Project

Information Comments Off on Programming Languages Project

Introduction

We’ve decided to make a java web application using database via MVC pattern.  To make a web application we use a glassfish server and primefaces.

Project Specification

Non functional:

– Availability.

– Recoverability.

– Maintainability.

 

Solution Design

Program Manual

Data Structures we used is an arraylist. It inherits AbstractList class and implements List interface. Java ArrayList allows us to randomly access the list and others i.e. implementing operators, etc.

Create a new web application. Now we make a database by creating a new java asp entity from database, we uses the model view controller file via mysql. The files made are in xhtml for the web. And it makes the packages for the navigating pages and the other for making the CRUD function.

The WEB-INF folder divides into the faces-config, glassfish-resources and web.xml the main requirements for running the program.  The games folder is in xhtml files as the algorithm explains the CRUD function when we click the links on the web.

Next, we go through the packages where is the main control of the program. First we go to the database.model package. First we make the abstract facade class. We import lists, validation, xml and the persistence so that it can create and remove persistent entity instances, to find entities by their primary key, and to query over entities.

The Games file shows the id name price and quantity by using set() and get() function to make the list. Implement serializable so that it can be saved to a database or transferred over a network. The @NamedQueries shows the command of the database for reading the database. For the overriding method, hashCode() Returns a hash code value for the object for the tables. And for toString() function the non string function are automatically converted to string.

The GamesController describes the selected lists when clicking on one of them. As from the previous, we implement serializable so it can save the database. Here we import jsfutil and pagination helper so that we can go navigate page by page. We make the Games, DataModel, gamesfacade, paginationhelper class private. TThen we make another class as static GamesControllerConvert by implementing converter so that it can convert to string. In the GamesFacade package we extend from the abstract class so it controls the entity manager by using inheritance.

We have the database.model.util. In the JsfUtil file, we import the javax faces and make the class abstract. The FacesContext represents all of the contextual information associated with processing an incoming request, and creating the corresponding response for the database.

Solution

 

 

 

 

 

 

 

References: https://www.youtube.com/watch?v=q-CzqROtoko Video Demo: https://drive.google.com/file/d/1-08wZb1lomLDlSpnKVpvReS0FGQ30oxo/view?usp=sharing Git link: https://github.com/alfir3dz1/programminglanguagesfinal

 

Members:

Alfi – 2101693574

Jason – 2101693510

Tama –  2101710920

May 08

Data Structures Project

Information Comments Off on Data Structures Project

Data Structures Report

Problem Description

We’ve chosen the third choice of how to find the player’s location in game which was snake. A location is required which the snake must find the food in order to grow and the food relocates itself after it’s being eaten. The snake has to eat the food to increase the score, as the score increases, the size of the snake should also increases. If it hits the wall, the game ends.

Objective by using C++:

− Identify the location of snake

− Location of food

− Relocation of the food

Data Structures Comparison

In this Snake project, we build the project with Array data structure for the snake and for the wall.  If we compare to templates, it also uses the types e.g. std:: and also the non type template parameters e.g. integral value, pointer to object/function, reference to object/function, pointer to member. Also we can also use an stl list. Although it’s not easy unlike arrays is that it has to go through all of the templates passed and we have to make a header for it. Another case is linked list. We have to use points and nodes for that. And it will be so much harder if we use linked list because we have to go through all of the nodes and function.

Program Manual

We use the libraries: <cstdlib> and <n.curses.h> i.e. using mac. We use width and height as const int so it measures the size of the maze. Score and fruit position uses int for the random position so after the snake eats and the score increases. The enum eDirection is the main control of the snake. TailX and TailY is the tail of the snake so that it increases after it eats the fruit.

The setup function: Sets game over to false so that the game continues to run. X and Y direction divides by the maze. The initscr() function also causes the first refresh operation to clear the screen. The noecho() routines control whether characters typed by the user are echoed by getch as they are typed. The curs_set() function sets the appearance of the cursor based on the value of visibility. The cbreak() routine disables line buffering and erase/kill character-processing, making characters typed by the user immediately available to the program. FruitX and FruitY locates the fruit randomly. We set the score to 0 as the starting point of the game. The dir direction is to identify whether the snake hits the wall or not. The clear() resets the error flags on a stream.

The draw function draws the game window. Again, we use clear() so that it resets an error. Use FruitX and FruitY  for random fruit placing and using 2d array looping for drawing window of the game; mvprintw to print out the window of the program. After drawing the board we use mvprintw and the score integer for the hud and refresh() for the program.

The logic function explains the process of the game how the snake controls, fruit and the game over condition.  Use switch statement for the control of snake, for loop to make the snake appear on the screen by putting prevx, prevy as an integer and tailx and taily for direction.  If statements explains the game over when the snake touches the tail and the scoring and growing. The input function is the snake’s control. We use getch() case and switch and input the arrow keys so that it can control the snake. We also put gameover true so that if the snake hits the wall, the game ends.

The main function is to put all the functions from the previous and for the game to run.

 

Github code(via partner Rizky):

https://github.com/rizkysuharyadi/Snake

Demo application(Execution of the program):

https://drive.google.com/file/d/1JmvrlAfCvzMgR9m1zDjqjwPyWnPvo6P4/view

Screenshots(execution of program):

Members:

  • Alfi – 2101693574
  • Rizky – 1801450680
Mar 08

Database System Project

Information Comments Off on Database System Project

Pharmacy Transaction System

Description

  • Create a pharmacy database by managing products, transactions that sells medical drugs for treat diseases or injuries. It can either be bought openly, required prescription, or exclusive for medical-licensed entity.
  • The goal of this transaction system is simple, to make pharmacies have an easier time managing their products on sale.
  • Not only sells, sells drugs, but also sells tools and other items related to health, including objects to assist disabled people like wheelchair, a crutch, etc..

Goals

  • Create a database architecture that can handle both transactions and items stocks counting
  • Create an UI that is easy to be used by most people.

Specifications

 

  • Alfi Mohamed Redzwan
  • Felix Anggara
  • Karuna

 

BINUS International

 

Report

Introduction

We created a small hospital business using database application that manages the operations of a hospital.

Specification(Diagram already provided from design)

The program will allow its user to browse through available products, both groceries and medicinal. In managing sold products, the database and the application has a restriction how the user will buy or not to buy the product due to the level of restriction from the administrator.

When a customer purchases a product, it will be added to the cart before finalising the purchase.

Database Mechanism

The category system of the database is separated into five groups: medicine, food, drink, medical equipment and others. These categories are further divided to various subcategories for the patients, such as drugs and groceries. Each products has their own restriction level for the patients which not to buy or which to.  After the patients buy and decide their purchase, it will be placed into carts and decide to cancel or finalise the purchase.

An empty invoice will be generated when finalising the purchase.  An invoice contains the client type, the branch where they’re purchased from, the pharmacist where the medicine will be created; this will be determined by the shopkeeper.

Program Analysis

Divided into two separate programs, user-side and admin-side. First, the shopkeeper or admin has to type the following password. Admin users can only be used by administrators. If the admin/user types the wrong password/username, it will inform that they typed the wrong password/username and must try again.

User-side Application

After logging in, the shopkeeper will see the main screen shows the product name, category, subcategory, restriction level and stock of product. It has the client type depending type, pharmacist for managing product. The shopkeeper can add, delete the following product and confirm before making the final purchase. Log off puts the shopkeeper back to the login screen.

The shopkeeper can also browse the available invoices by selecting the “Browse Invoice” button, which shows the branch, invoice, shopkeeper and pharmacist assigned to.

Admin-side Application

For admin user, the admin can either restock products, manage products, manage shopkeepers, manage branches, manage invoices or log off which goes back to the login screen.

Choosing restock products goes to restock menu to restock products. The admin can add or reduce stock but first the admin must choose a product otherwise it will show an error. If the quantity puts negative while the admin reduces stock it will be set to 0.

Choosing manage products goes to the manage menu that shows the product id, subcategory, restriction, branch, product name, description, price and for sale. It has also the button  add product, delete product, update product, enable product sale and disable product sale. Adding the product requires to fill in the entry form. Delete to choose the product from list, update entry requires choosing the product and changing the name, desc or price. Enabling and disabling the entry sale sets the product to be sold or not by clicking the product on the list.

Choosing manage branches shows the lists of the branch id, branch name, shopkeeper and in operation. The button add branch, delete branch, update branch, enable branch and disable branch works similar to managing products while filling the name and shopkeeper for adding and others for clicking on the list.

Choosing manage shopkeeper shows the shopkeeper id, branch, name, gender, age , phone, comment for logging in, active and admin permission. The add, delete, update, enable and disable shopkeeper button works the same from the previous(manage products) by just filling the name, age, branch, gender, phone number and comment; delete, update, enable and disable by clicking on the list.

Choosing manage invoice shows the invoice id, branch, shopkeeper and pharmacist. The add, delete and update invoice button works the same from the previous(manage products) by just filling the client type, branch, shopkeeper and pharmacist.

Choosing manage pharmacist shows the pharmacist id, branch, name, gender and active. Active shows if the pharmacist is active for managing products, if it’s false then the product controlled by pharmacist is unavailable. The add, delete, update, enable and disable  pharmacist button works the same from the previous(manage products) by just filling the name, gender and branch.

Development

The program used for making the application is phpmyadmin/mariadb and visual basic for making the application. In Visual Basic, the application divides into user for buying the product and admin for managing products because the admin position is complicated.  Also, we add disable/enable the product because before using it, when it erases the record the money will be bankrupt.

Conclusion

We learned how to create a proper database via Visual Basic Application. We used two logins: admin and user because the admin was very complicated without using the user for them to buy the product. And also Database and Application for handling.

Alfi Redzwan – 2101693574
Felix Anggara – 2101693851
Karuna – 1901520233

Mar 08

About me

Information Comments Off on About me

Info

P.S. (2018) My previous blog from last month was corrupted so check the one last month before corruption/error. Sorry for any inconvenience caused…

Mar 08

Description by clicking the link