Checkpoint 3.1.9. A Python program, including another.
Compute the total amount of money loaned and store it in the variable
loan_total
.#include <stdio.h>
int main(void)
{
puts("Hello, world!");
}
import javax.swing.JFrame; //Importing class JFrame
import javax.swing.JLabel; //Importing class JLabel
public class HelloWorld {
public static void main(String[] args) {
JFrame frame = new JFrame(); //Creating frame
frame.setTitle("Hi!"); //Setting title frame
frame.add(new JLabel("Hello, world!"));//Adding text to frame
frame.pack(); //Setting size to smallest
frame.setLocationRelativeTo(null); //Centering frame
frame.setVisible(true); //Showing frame
}
}
<program>
is not interactive, by default, no matter where it is hosted.import javax.swing.JFrame; //Importing class JFrame
import javax.swing.JLabel; //Importing class JLabel
public class HelloWorld {
public static void main(String[] args) {
JFrame frame = new JFrame(); //Creating frame
frame.setTitle("Hi!"); //Setting title frame
frame.add(new JLabel("Hello, world!"));//Adding text to frame
frame.pack(); //Setting size to smallest
frame.setLocationRelativeTo(null); //Centering frame
frame.setVisible(true); //Showing frame
}
}
x = 2 + 2
printf("%d\n", x)
program HelloWorld;
begin
WriteLn('Hello, world!');
end.
<listing>
since we will want to reference it shortly. The program does not do very much, it just defines four variables whose values are lists of statistics. It should run, and there will be no syntax errors, but it is a bit boring since there is no output.@include
attribute on the including program whose value is the @xml:id
of the included program. So by running the next program, it should pass all of its three tests (for example another example using unit tests, see Checkpoint 3.3.4). Now reload the page, do not run the program in the listing, and then see that the program in the exercise still runs correctly.loan_total
.print()
statement.loan_total
.@language
set to sql
uses the @database
to load a SQLite database file.test
database table.