Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Other

D335 Introduction to Programming in Python (PA study guide 2025) Western Governors University

Rating
-
Sold
-
Pages
23
Uploaded on
16-05-2025
Written in
2024/2025

D335 Introduction to Programming in Python (PA study guide 2025) Western Governors University 20.01 Practice Lab 1 (Introduction to Java) INSTRUCTIONS: Write a program that outputs the pattern shown below, ending with a newline. Each line of the pattern contains 5 characters including whitespace. OUTPUT: H H H H HHHHH H H H H SOLUTION (in red): public class Lab { public static void main(String[] args) { /* Type your code here. */ Sln("H H"); Sln("H H"); Sln("HHHHH"); Sln("H H"); Sln("H H");

Show more Read less

Content preview

D335 Introduction to Programming in Python (PA study
guide 2025) Western Governors University

20.01 Practice Lab 1 (Introduction to Java)

INSTRUCTIONS:
Write a program that outputs the pattern shown below, ending with a newline. Each line of the pattern contains 5
characters including whitespace.

OUTPUT:
H H
H H
HHHHH
H H
H H

SOLUTION (in red):

public class Lab {
public static void main(String[] args) {
/* Type your code here. */
System.out.println("H H");
System.out.println("H H");
System.out.println("HHHHH");
System.out.println("H H");
System.out.println("H H");
}
}

WALKTHROUGH:
Just pay attention to how many characters are required on each line and use System.println();




20.02 Practice Lab 2 (Multiplication)

INSTRUCTIONS:
For this lab you will use unit testing to check a null setting using assertions. Use the commented template code
provided to do the following:

Write a program that collects two integer inputs and assigns them to the variables starting_num and multiplier.
Multiply starting_num by multiplier and output the result. Repeat this process two more times, each time
multiplying the previous result by multiplier. The three product outputs should be separated by a whitespace
character, ending with a newline.

,If the input is:
25
the output when starting_num = 2 is: 10
50 250

, SOLUTION (in red):

import java.util.Scanner; public
class LabProgram {
public static void main(String[] args) { Scanner
scnr = new Scanner(System.in);
/* Type your code here. */

int num1 = scnr.nextInt();
int num2 = scnr.nextInt();

int starting_num = num1;
int multiplier = num2;

int result1 = starting_num * multiplier;
int result2 = result1 * multiplier;
int result3 = result2 * multiplier; System.out.println(result1
+ " " + result2 + " " + result3);
}
}

OR

int starting_num = scnr.nextInt(); int
multiplier = scnr.nextInt();

for (int i = 0; i < 3; i++) { result
*= multiplier;
System.out.print(result);

if (i < 2) {
System.out.print(“ “);
}
}
System.out.println();




20.03 Practice Lab 3 (Wedding Tables)
INSTRUCTIONS:
Write a program that calculates the number of full tables for a wedding event, based on the number of expected
guests. Each full table will seat 10 wedding guests.

Collect one integer input and assign it to the variable guests. Using integer division, calculate the total number of
tables that will be filled. The variable tableSize has been declared and initialized and the variables guests and
tablesFilled have been declared in the template code.

Document information

Uploaded on
May 16, 2025
Number of pages
23
Written in
2024/2025
Type
OTHER
Person
Unknown

Subjects

$15.99
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
smartzone Liberty University
View profile
Follow You need to be logged in order to follow users or courses
Sold
3295
Member since
6 year
Number of followers
2295
Documents
14607
Last sold
1 day ago
AMAIZING EDUCATION WORLD

GET ALL KIND OF EXAMS ON THIS PAGE ,COMPLETE TEST BANKS,SUMMARIES,STUDY GUIDES,PROJECT PAPERS,ASSIGNMENTS,CASE STUDIES, YOU CAN ALSO COMMUNICATE WITH THE SELLER FOR ANY PRE-ORDER,ORDER AND ETC.

3.7

599 reviews

5
267
4
94
3
104
2
31
1
103

Trending documents

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions