Updated: Monday, August 28,2023-08-28 11:26:17
parent
58a1846dcb
commit
e4e15e3dd5
|
@ -1,13 +1,13 @@
|
||||||
{
|
{
|
||||||
"recentFiles": [
|
"recentFiles": [
|
||||||
{
|
|
||||||
"basename": "Java",
|
|
||||||
"path": "Java.md"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"basename": "Fortran",
|
"basename": "Fortran",
|
||||||
"path": "Coding Tips (Classical)/Terminal Tips/Languages/Fortran.md"
|
"path": "Coding Tips (Classical)/Terminal Tips/Languages/Fortran.md"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"basename": "Java",
|
||||||
|
"path": "Coding Tips (Classical)/Terminal Tips/Languages/Java.md"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"basename": "6. Sample Bookkeeping",
|
"basename": "6. Sample Bookkeeping",
|
||||||
"path": "Coding Tips (Classical)/Project Vault/Comms/WRITTEN TEXT/E-Mail Settings/6. Sample Bookkeeping.md"
|
"path": "Coding Tips (Classical)/Project Vault/Comms/WRITTEN TEXT/E-Mail Settings/6. Sample Bookkeeping.md"
|
||||||
|
|
|
@ -130,7 +130,7 @@
|
||||||
"state": {
|
"state": {
|
||||||
"type": "markdown",
|
"type": "markdown",
|
||||||
"state": {
|
"state": {
|
||||||
"file": "Java.md",
|
"file": "Coding Tips (Classical)/Terminal Tips/Languages/Fortran.md",
|
||||||
"mode": "source",
|
"mode": "source",
|
||||||
"backlinks": false,
|
"backlinks": false,
|
||||||
"source": false
|
"source": false
|
||||||
|
@ -200,7 +200,7 @@
|
||||||
"state": {
|
"state": {
|
||||||
"type": "outline",
|
"type": "outline",
|
||||||
"state": {
|
"state": {
|
||||||
"file": "Java.md"
|
"file": "Coding Tips (Classical)/Terminal Tips/Languages/Fortran.md"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -210,7 +210,7 @@
|
||||||
"state": {
|
"state": {
|
||||||
"type": "outgoing-link",
|
"type": "outgoing-link",
|
||||||
"state": {
|
"state": {
|
||||||
"file": "Java.md",
|
"file": "Coding Tips (Classical)/Terminal Tips/Languages/Fortran.md",
|
||||||
"linksCollapsed": false,
|
"linksCollapsed": false,
|
||||||
"unlinkedCollapsed": true
|
"unlinkedCollapsed": true
|
||||||
}
|
}
|
||||||
|
@ -237,8 +237,8 @@
|
||||||
},
|
},
|
||||||
"active": "5ea761f970043868",
|
"active": "5ea761f970043868",
|
||||||
"lastOpenFiles": [
|
"lastOpenFiles": [
|
||||||
|
"Coding Tips (Classical)/Terminal Tips/Languages/Java.md",
|
||||||
"Coding Tips (Classical)/Terminal Tips/Languages/Fortran.md",
|
"Coding Tips (Classical)/Terminal Tips/Languages/Fortran.md",
|
||||||
"Java.md",
|
|
||||||
"Coding Tips (Classical)/Project Vault/Comms/WRITTEN TEXT/E-Mail Settings/6. Sample Bookkeeping.md",
|
"Coding Tips (Classical)/Project Vault/Comms/WRITTEN TEXT/E-Mail Settings/6. Sample Bookkeeping.md",
|
||||||
"Coding Tips (Classical)/Project Vault/Comms/WRITTEN TEXT/E-Mail Settings/E-Mail.md",
|
"Coding Tips (Classical)/Project Vault/Comms/WRITTEN TEXT/E-Mail Settings/E-Mail.md",
|
||||||
"Coding Tips (Classical)/Project Vault/Comms/WRITTEN TEXT/E-Mail Settings/5. Quantum Cover Letter.md",
|
"Coding Tips (Classical)/Project Vault/Comms/WRITTEN TEXT/E-Mail Settings/5. Quantum Cover Letter.md",
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
Fortran stands for **For**mula **Tran**slating System - a programming language developed in 1857 at IBM.
|
Fortran stands for **For**mula **Tran**slating System - a programming language developed in 1857 at IBM.
|
||||||
|
|
||||||
program hello_world.f90
|
program hello_world.f90
|
||||||
```
|
```fortran
|
||||||
program first
|
program first
|
||||||
implicit none
|
implicit none
|
||||||
! write 'Hello World!' to stdout
|
! write 'Hello World!' to stdout
|
||||||
|
@ -18,7 +18,7 @@ $ ./hello_world
|
||||||
All code taked place between the program first and end program first statements, where first is the nmae given to the program. The `!` indicates a comment and the `write(*,*)` instructs the computer to write the statement Hello World to the screen, indicated by the first asterisk using free-format, the second asterisk. The implicit none if a very important statement as well.
|
All code taked place between the program first and end program first statements, where first is the nmae given to the program. The `!` indicates a comment and the `write(*,*)` instructs the computer to write the statement Hello World to the screen, indicated by the first asterisk using free-format, the second asterisk. The implicit none if a very important statement as well.
|
||||||
|
|
||||||
|
|
||||||
```
|
```fortran
|
||||||
program temperature
|
program temperature
|
||||||
implicit none
|
implicit none
|
||||||
! declare variables
|
! declare variables
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
The very first object-oriented language I learned when I was 19 in my computer science & engineering program at school. I had my professor Jeff Meunier teaching us through making projects which, looking back, was the best way that he could have taught us Java to be honest. It was and still is an incredibly verbose language but at the end we made a cool project with a music beat to it. I struggled with it before but I wonder how well I would do at it now.
|
The very first object-oriented language I learned when I was 19 in my computer science & engineering program at school. I had my professor Jeff Meunier teaching us through making projects which, looking back, was the best way that he could have taught us Java to be honest. It was and still is an incredibly verbose language but at the end we made a cool project with a music beat to it. I struggled with it before but I wonder how well I would do at it now.
|
||||||
|
|
||||||
|
|
||||||
|
This was the main part of the code that I was really stoked that I figured out. Looking back i don't really know why...
|
||||||
|
|
||||||
```java
|
```java
|
||||||
public Chord(Sound[] sounds)
|
public Chord(Sound[] sounds)
|
||||||
|
|
||||||
|
@ -25,7 +27,7 @@ Recommended reading in the Murach book:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### Steps
|
#### Steps for the old java synthesizer assignment
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -46,7 +48,7 @@ Make a `IPublisher` and `ISubscriber` class/interface
|
||||||
|
|
||||||
- In IPublisher interface copy&paste:
|
- In IPublisher interface copy&paste:
|
||||||
|
|
||||||
```
|
```java
|
||||||
public interface IPublisher
|
public interface IPublisher
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -62,7 +64,7 @@ public interface IPublisher
|
||||||
|
|
||||||
- In ISubscriber interface copy&paste:
|
- In ISubscriber interface copy&paste:
|
||||||
|
|
||||||
```
|
```java
|
||||||
public interface ISubscriber
|
public interface ISubscriber
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -90,7 +92,7 @@ There will be redlines and therefore right click to automatically correct
|
||||||
|
|
||||||
Create a constructor:
|
Create a constructor:
|
||||||
|
|
||||||
```
|
```java
|
||||||
public Broadcaster(int max_subscribers){
|
public Broadcaster(int max_subscribers){
|
||||||
|
|
||||||
int [ ] array = _iSubscriberholder;
|
int [ ] array = _iSubscriberholder;
|
||||||
|
@ -109,7 +111,7 @@ private int[ ] _iSubscriberholder
|
||||||
5. Creating the subscribe method in the Broadcaster class
|
5. Creating the subscribe method in the Broadcaster class
|
||||||
|
|
||||||
|
|
||||||
```
|
```java
|
||||||
private int x = 0;
|
private int x = 0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -138,7 +140,7 @@ public void subscribe(ISubscriber subscriber){
|
||||||
|
|
||||||
example:
|
example:
|
||||||
|
|
||||||
```
|
```java
|
||||||
/**
|
/**
|
||||||
|
|
||||||
* Broadcasts a message to multiple subscribers.
|
* Broadcasts a message to multiple subscribers.
|
||||||
|
@ -264,7 +266,7 @@ to fix: don’t call notify method on null array location
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
11. Copy&Paste Broadcaster class and rename as `Sequencer`
|
11. Copy&Paste `Broadcaster`class and rename as `Sequencer`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -328,7 +330,7 @@ TestSubscriber notified, name = second
|
||||||
|
|
||||||
code should look like this:
|
code should look like this:
|
||||||
|
|
||||||
```
|
```java
|
||||||
public static void main(String[] args)
|
public static void main(String[] args)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -547,11 +549,8 @@ instance. lolwut?
|
||||||
It works like this:
|
It works like this:
|
||||||
|
|
||||||
|
|
||||||
```
|
```java
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
```
|
|
||||||
for(some loop)
|
for(some loop)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -562,6 +561,9 @@ for(some loop)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -582,7 +584,7 @@ You should hear all three sounds played at the same time
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
34. create a SoundBank class in the model package
|
34. create a `SoundBank` class in the model package
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -590,12 +592,16 @@ You should hear all three sounds played at the same time
|
||||||
35. Give this class a constructor that has a Sound array parameter and stores that array in a member var iable.
|
35. Give this class a constructor that has a Sound array parameter and stores that array in a member var iable.
|
||||||
|
|
||||||
|
|
||||||
|
```java
|
||||||
|
|
||||||
Sound [ ] _soundbanks;
|
Sound [ ] _soundbanks;
|
||||||
|
|
||||||
SoundBank(Sound[ ] y){
|
SoundBank(Sound[ ] y){
|
||||||
|
|
||||||
y = _soundbanks;}
|
y = _soundbanks;}
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -607,6 +613,8 @@ y = _soundbanks;}
|
||||||
37. TestSoundBank
|
37. TestSoundBank
|
||||||
|
|
||||||
|
|
||||||
|
```java
|
||||||
|
|
||||||
public static void main(String[] args)
|
public static void main(String[] args)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -626,16 +634,23 @@ public static void main(String[] args)
|
||||||
c.notify(null);
|
c.notify(null);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
Also make sure that this works:
|
Also make sure that this works:
|
||||||
|
```java
|
||||||
|
|
||||||
Chord c = sb.chord(new int[]{0, 1, 2});
|
Chord c = sb.chord(new int[]{0, 1, 2});
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
38. Test this in the main class:
|
38. Test this in the main class:
|
||||||
|
|
||||||
|
|
||||||
|
```java
|
||||||
|
|
||||||
public static void main(String[] args)
|
public static void main(String[] args)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -700,6 +715,8 @@ public static void main(String[] args)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
It should work, sequence of 16 beats that repeats twice
|
It should work, sequence of 16 beats that repeats twice
|
||||||
|
@ -721,4 +738,3 @@ Delete these classes:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
**
|
|
Loading…
Reference in New Issue