Skip to content

Instantly share code, notes, and snippets.

@JorgeOlvera
JorgeOlvera / Tarea Programación
Created October 25, 2013 04:01
First attempt at java programming ....Output in Shakespearean English, why not
import java.io.*;
//Convertir Centigrados a Farenheit, MXN a DLS, y resolver funcion de x//
public class ShakespeareanConverter {
public static void main(String[] args) throws IOException{
InputStreamReader inStream = new InputStreamReader(System.in);
BufferedReader systemIn = new BufferedReader (inStream);
String c, f, mxn, dls, x;
/*4. An employee receives the regular pay rate for the first 30 hours and he is paid 1½
times the normal rate for each hour over the 30 hours. Write a program (save it as
BonusWage) that prompts the user for the regular pay rate and the hours worked and
then it will calculate and display on screen the employee’s wage based on that
information and the criteria mentioned above. For example, if 42 is entered for hours and
/*3. Shirts are on sale for $10 each if more than three are purchased and $12 each
otherwise. Write a program (save it as Shirts) that prompts the user for the number of
shirts purchased and display on screen the total cost according to the mentioned criteria.
*/
import java.util.Scanner;
import java.io.*;
public class Shirts {
/*2. Write a program (save it as PosNeg) that prompts the user for an integer number and
it would display on screen the message “The number is positive” if it is a positive number
and “The number is negative” if otherwise.
*/
import java.util.Scanner;
import java.io.*;
public class PosNeg {
/*2. Write a program (save it as PosNeg) that prompts the user for an integer number and
it would display on screen the message “The number is positive” if it is a positive number
and “The number is negative” if otherwise.
*/
import java.util.Scanner;
import java.io.*;
public class PosNeg {
/*1. Write a program (save it as Fever) that prompts the user for a patient’s temperature
and would display on screen if he/she has fever depending whether his/her temperature
exceeds 39° Celsius. If it is less than that, then the patient has normal temperature
*/
import java.util.Scanner;
import java.io.*;
public class fever {
public static void main(String[] args) {
@JorgeOlvera
JorgeOlvera / Delicatessen
Created November 14, 2013 05:15
Lab MultiBranching
/*Your program asks for the item, its price,
and if overnight shipping is wanted.
Regular shipping for items under $10 is $2.00;
for items $10 or more shipping is $3.00.
For overnight delivery add $5.00.*/
import java.util.Scanner;
import java.io.*;
public class Delicatessen{
public static void main(String[] args) {
@JorgeOlvera
JorgeOlvera / AsteriskTriangle
Created November 14, 2013 05:17
For Looping
import java.io.*;
import java.util.Scanner;
public class AsteriskTriangle {
public static void main (String [] args) {
Scanner input = new Scanner(System.in);
System.out.println("Type an integer: ");
int nmbr = input.nextInt();
@JorgeOlvera
JorgeOlvera / CountingLetters
Created November 14, 2013 05:19
Looping Lab
import java.io.*;
import java.util.Scanner;
public class CountingLetters {
public static void main (String [] args) {
Scanner input = new Scanner(System.in);
String firstWord, secondWord
System.out.println("Enter first word: ");
import java.io.*;
import java.util.Scanner;
public class elections2{
public static void main (String[] args) {
Scanner input = new Scanner(System.in);
char candidate;
System.out.println("Please introduce your candidate. Introduce a character ");